diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-09-25 00:01:25 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-09-25 00:01:25 +0100 |
commit | d89510e1aa9d27a7afcc069dbc8001663258af78 (patch) | |
tree | 342ba00e18947c4846fc272aae526ed36381a2ec /input.c | |
parent | 2534aa4d2d0b29013065468f75fb407c6eb603c4 (diff) | |
parent | e3359f8349cf972052604c089b5bab71f5e33095 (diff) | |
download | rtmux-d89510e1aa9d27a7afcc069dbc8001663258af78.tar.gz rtmux-d89510e1aa9d27a7afcc069dbc8001663258af78.tar.bz2 rtmux-d89510e1aa9d27a7afcc069dbc8001663258af78.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 27 |
1 files changed, 17 insertions, 10 deletions
@@ -888,7 +888,8 @@ 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; + const struct input_state *state = NULL; + const struct input_transition *itr = NULL; size_t off = 0; if (len == 0) @@ -916,16 +917,22 @@ input_parse_buffer(struct window_pane *wp, u_char *buf, size_t len) ictx->ch = buf[off++]; /* Find the transition. */ - itr = ictx->state->transitions; - while (itr->first != -1 && itr->last != -1) { - if (ictx->ch >= itr->first && ictx->ch <= itr->last) - break; - itr++; - } - if (itr->first == -1 || itr->last == -1) { - /* No transition? Eh? */ - fatalx("no transition from state"); + if (ictx->state != state || + itr == NULL || + ictx->ch < itr->first || + ictx->ch > itr->last) { + itr = ictx->state->transitions; + while (itr->first != -1 && itr->last != -1) { + if (ictx->ch >= itr->first && ictx->ch <= itr->last) + break; + itr++; + } + if (itr->first == -1 || itr->last == -1) { + /* No transition? Eh? */ + fatalx("no transition from state"); + } } + state = ictx->state; /* * Any state except print stops the current collection. This is |