diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2020-05-01 17:01:36 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2020-05-01 17:01:36 +0100 |
commit | 8110c7a25f257b13f92f34559efedba204e6ea98 (patch) | |
tree | 1a27040ddeb828a865b28323ee4516f053292591 /input.c | |
parent | dbebdb2d364feea4df958528ee1dcacbb9933e37 (diff) | |
download | rtmux-8110c7a25f257b13f92f34559efedba204e6ea98.tar.gz rtmux-8110c7a25f257b13f92f34559efedba204e6ea98.tar.bz2 rtmux-8110c7a25f257b13f92f34559efedba204e6ea98.zip |
Do not hoke into struct window_pane from the tty code and instead set
everything up in tty_ctx. Provide a way to initialize the tty_ctx from a
callback and use it to let popups draw directly through input_parse in the same
way as panes do, rather than forcing a full redraw on every change.
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 37 |
1 files changed, 12 insertions, 25 deletions
@@ -842,9 +842,9 @@ input_reset(struct input_ctx *ictx, int clear) if (clear && wp != NULL) { if (TAILQ_EMPTY(&wp->modes)) - screen_write_start(sctx, wp, &wp->base); + screen_write_start_pane(sctx, wp, &wp->base); else - screen_write_start(sctx, NULL, &wp->base); + screen_write_start(sctx, &wp->base); screen_write_reset(sctx); screen_write_stop(sctx); } @@ -960,9 +960,9 @@ input_parse_buffer(struct window_pane *wp, u_char *buf, size_t len) /* NULL wp if there is a mode set as don't want to update the tty. */ if (TAILQ_EMPTY(&wp->modes)) - screen_write_start(sctx, wp, &wp->base); + screen_write_start_pane(sctx, wp, &wp->base); else - screen_write_start(sctx, NULL, &wp->base); + screen_write_start(sctx, &wp->base); log_debug("%s: %%%u %s, %zu bytes: %.*s", __func__, wp->id, ictx->state->name, len, (int)len, buf); @@ -973,15 +973,15 @@ input_parse_buffer(struct window_pane *wp, u_char *buf, size_t len) /* Parse given input for screen. */ void -input_parse_screen(struct input_ctx *ictx, struct screen *s, u_char *buf, - size_t len) +input_parse_screen(struct input_ctx *ictx, struct screen *s, + screen_write_init_ctx_cb cb, void *arg, u_char *buf, size_t len) { struct screen_write_ctx *sctx = &ictx->ctx; if (len == 0) return; - screen_write_start(sctx, NULL, s); + screen_write_start_callback(sctx, s, cb, arg); input_parse(ictx, buf, len); screen_write_stop(sctx); } @@ -1630,7 +1630,6 @@ static void input_csi_dispatch_rm_private(struct input_ctx *ictx) { struct screen_write_ctx *sctx = &ictx->ctx; - struct window_pane *wp = ictx->wp; struct grid_cell *gc = &ictx->cell.cell; u_int i; @@ -1675,16 +1674,10 @@ input_csi_dispatch_rm_private(struct input_ctx *ictx) break; case 47: case 1047: - if (wp != NULL) - window_pane_alternate_off(wp, gc, 0); - else - screen_alternate_off(sctx->s, gc, 0); + screen_write_alternateoff(sctx, gc, 0); break; case 1049: - if (wp != NULL) - window_pane_alternate_off(wp, gc, 1); - else - screen_alternate_off(sctx->s, gc, 1); + screen_write_alternateoff(sctx, gc, 1); break; case 2004: screen_write_mode_clear(sctx, MODE_BRACKETPASTE); @@ -1780,16 +1773,10 @@ input_csi_dispatch_sm_private(struct input_ctx *ictx) break; case 47: case 1047: - if (wp != NULL) - window_pane_alternate_on(wp, gc, 0); - else - screen_alternate_on(sctx->s, gc, 0); + screen_write_alternateon(sctx, gc, 0); break; case 1049: - if (wp != NULL) - window_pane_alternate_on(wp, gc, 1); - else - screen_alternate_on(sctx->s, gc, 1); + screen_write_alternateon(sctx, gc, 1); break; case 2004: screen_write_mode_set(sctx, MODE_BRACKETPASTE); @@ -2593,7 +2580,7 @@ input_osc_52(struct input_ctx *ictx, const char *p) return; } - screen_write_start(&ctx, wp, NULL); + screen_write_start_pane(&ctx, wp, NULL); screen_write_setselection(&ctx, out, outlen); screen_write_stop(&ctx); notify_pane("pane-set-clipboard", wp); |