summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-08-18 21:41:13 +0000
committernicm <nicm@openbsd.org>2009-08-18 21:41:13 +0000
commit88a809019a5f415ebff94173b5a65916a88088bd (patch)
tree15f65234e0cb3a2aab8cfeb3a4142233089622b1
parentWhoops, getting the comparison the right way round is usually recommended. (diff)
downloadwireguard-openbsd-88a809019a5f415ebff94173b5a65916a88088bd.tar.xz
wireguard-openbsd-88a809019a5f415ebff94173b5a65916a88088bd.zip
Instead of just checking for an empty buffer, which may not be the case if
there is unconsumed data, save the previous size and use it instead. This means that activity monitoring should work in this (unlikely) event. Also remove a debugging statement that no longer seems necessary.
-rw-r--r--usr.bin/tmux/input.c12
-rw-r--r--usr.bin/tmux/tmux.h3
2 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index 16a6d9ee020..0fb7f552f41 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.12 2009/08/08 15:57:49 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.13 2009/08/18 21:41:13 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -235,6 +235,8 @@ input_init(struct window_pane *wp)
ictx->saved_cy = 0;
input_state(ictx, input_state_first);
+
+ ictx->was = 0;
}
void
@@ -252,8 +254,9 @@ input_parse(struct window_pane *wp)
struct input_ctx *ictx = &wp->ictx;
u_char ch;
- if (BUFFER_USED(wp->in) == 0)
+ if (BUFFER_USED(wp->in) == ictx->was)
return;
+ wp->window->flags |= WINDOW_ACTIVITY;
ictx->buf = BUFFER_OUT(wp->in);
ictx->len = BUFFER_USED(wp->in);
@@ -261,15 +264,11 @@ input_parse(struct window_pane *wp)
ictx->wp = wp;
- log_debug2("entry; buffer=%zu", ictx->len);
-
if (wp->mode == NULL)
screen_write_start(&ictx->ctx, wp, &wp->base);
else
screen_write_start(&ictx->ctx, NULL, &wp->base);
- if (ictx->off != ictx->len)
- wp->window->flags |= WINDOW_ACTIVITY;
while (ictx->off < ictx->len) {
ch = ictx->buf[ictx->off++];
ictx->state(ch, ictx);
@@ -278,6 +277,7 @@ input_parse(struct window_pane *wp)
screen_write_stop(&ictx->ctx);
buffer_remove(wp->in, ictx->len);
+ ictx->was = BUFFER_USED(wp->in);
}
void
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index fa7403e74be..637e78f8c58 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.85 2009/08/18 14:48:42 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.86 2009/08/18 21:41:13 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -617,6 +617,7 @@ struct input_ctx {
u_char *buf;
size_t len;
size_t off;
+ size_t was;
struct grid_cell cell;