diff options
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 59 |
1 files changed, 52 insertions, 7 deletions
@@ -110,6 +110,8 @@ static void input_set_state(struct window_pane *, static void input_reset_cell(struct input_ctx *); static void input_osc_4(struct window_pane *, const char *); +static void input_osc_10(struct window_pane *, const char *); +static void input_osc_11(struct window_pane *, const char *); static void input_osc_52(struct window_pane *, const char *); static void input_osc_104(struct window_pane *, const char *); @@ -1123,7 +1125,7 @@ input_c0_dispatch(struct input_ctx *ictx) case '\012': /* LF */ case '\013': /* VT */ case '\014': /* FF */ - screen_write_linefeed(sctx, 0); + screen_write_linefeed(sctx, 0, ictx->cell.cell.bg); break; case '\015': /* CR */ screen_write_carriagereturn(sctx); @@ -1168,18 +1170,18 @@ input_esc_dispatch(struct input_ctx *ictx) screen_write_reset(sctx); break; case INPUT_ESC_IND: - screen_write_linefeed(sctx, 0); + screen_write_linefeed(sctx, 0, ictx->cell.cell.bg); break; case INPUT_ESC_NEL: screen_write_carriagereturn(sctx); - screen_write_linefeed(sctx, 0); + screen_write_linefeed(sctx, 0, ictx->cell.cell.bg); break; case INPUT_ESC_HTS: if (s->cx < screen_size_x(s)) bit_set(s->tabs, s->cx); break; case INPUT_ESC_RI: - screen_write_reverseindex(sctx); + screen_write_reverseindex(sctx, ictx->cell.cell.bg); break; case INPUT_ESC_DECKPAM: screen_write_mode_set(sctx, MODE_KKEYPAD); @@ -1417,7 +1419,8 @@ input_csi_dispatch(struct input_ctx *ictx) input_csi_dispatch_sm_private(ictx); break; case INPUT_CSI_SU: - screen_write_scrollup(sctx, input_get(ictx, 0, 1, 1)); + screen_write_scrollup(sctx, input_get(ictx, 0, 1, 1), + ictx->cell.cell.bg); break; case INPUT_CSI_TBC: switch (input_get(ictx, 0, 0, 0)) { @@ -1899,13 +1902,19 @@ input_exit_osc(struct input_ctx *ictx) case 4: input_osc_4(ictx->wp, p); break; - case 52: - input_osc_52(ictx->wp, p); + case 10: + input_osc_10(ictx->wp, p); + break; + case 11: + input_osc_11(ictx->wp, p); break; case 12: if (*p != '?') /* ? is colour request */ screen_set_cursor_colour(ictx->ctx.s, p); break; + case 52: + input_osc_52(ictx->wp, p); + break; case 104: input_osc_104(ictx->wp, p); break; @@ -2051,6 +2060,42 @@ bad: free(copy); } +/* Handle the OSC 10 sequence for setting background colour. */ +static void +input_osc_10(struct window_pane *wp, const char *p) +{ + u_int r, g, b; + + if (sscanf(p, "rgb:%2x/%2x/%2x", &r, &g, &b) != 3) + goto bad; + + wp->colgc.fg = colour_join_rgb(r, g, b); + wp->flags |= PANE_REDRAW; + + return; + +bad: + log_debug("bad OSC 10: %s", p); +} + +/* Handle the OSC 11 sequence for setting background colour. */ +static void +input_osc_11(struct window_pane *wp, const char *p) +{ + u_int r, g, b; + + if (sscanf(p, "rgb:%2x/%2x/%2x", &r, &g, &b) != 3) + goto bad; + + wp->colgc.bg = colour_join_rgb(r, g, b); + wp->flags |= PANE_REDRAW; + + return; + +bad: + log_debug("bad OSC 11: %s", p); +} + /* Handle the OSC 52 sequence for setting the clipboard. */ static void input_osc_52(struct window_pane *wp, const char *p) |