=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/input.c,v retrieving revision 1.151 retrieving revision 1.152 diff -u -r1.151 -r1.152 --- src/usr.bin/tmux/input.c 2019/05/03 20:44:24 1.151 +++ src/usr.bin/tmux/input.c 2019/05/07 10:25:15 1.152 @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.151 2019/05/03 20:44:24 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.152 2019/05/07 10:25:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -874,18 +874,27 @@ void input_parse(struct window_pane *wp) { + struct evbuffer *evb = wp->event->input; + + input_parse_buffer(wp, EVBUFFER_DATA(evb), EVBUFFER_LENGTH(evb)); + evbuffer_drain(evb, EVBUFFER_LENGTH(evb)); +} + +/* Parse given input. */ +void +input_parse_buffer(struct window_pane *wp, u_char *buf, size_t len) +{ struct input_ctx *ictx = wp->ictx; struct screen_write_ctx *sctx = &ictx->ctx; const struct input_transition *itr; - struct evbuffer *evb = wp->event->input; - u_char *buf; - size_t len, off; + size_t off = 0; - if (EVBUFFER_LENGTH(evb) == 0) + if (len == 0) return; window_update_activity(wp->window); wp->flags |= PANE_CHANGED; + notify_input(wp, buf, len); /* * Open the screen. Use NULL wp if there is a mode set as don't want to @@ -897,12 +906,6 @@ screen_write_start(sctx, NULL, &wp->base); ictx->wp = wp; - buf = EVBUFFER_DATA(evb); - len = EVBUFFER_LENGTH(evb); - off = 0; - - notify_input(wp, evb); - log_debug("%s: %%%u %s, %zu bytes: %.*s", __func__, wp->id, ictx->state->name, len, (int)len, buf); @@ -950,8 +953,6 @@ /* Close the screen. */ screen_write_stop(sctx); - - evbuffer_drain(evb, len); } /* Split the parameter list (if any). */