From 4631c074836b5b75e8b170a460f53de8f5507096 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Thu, 20 Aug 2009 11:48:01 +0000 Subject: [PATCH] Sync OpenBSD patchset 275: 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. --- input.c | 12 ++++++------ tmux.h | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/input.c b/input.c index a80d664c..6fb213a4 100644 --- a/input.c +++ b/input.c @@ -1,4 +1,4 @@ -/* $Id: input.c,v 1.92 2009-08-19 09:04:48 nicm Exp $ */ +/* $Id: input.c,v 1.93 2009-08-20 11:48:01 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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/tmux.h b/tmux.h index f8b14540..80b06ed2 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.423 2009-08-20 11:35:16 tcunha Exp $ */ +/* $Id: tmux.h,v 1.424 2009-08-20 11:48:01 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -615,6 +615,7 @@ struct input_ctx { u_char *buf; size_t len; size_t off; + size_t was; struct grid_cell cell;