From e85ea9f67dcecab91599a658ad694d8e08514509 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 16 Aug 2019 08:52:25 +0000 Subject: grid_view_delete_cells does need to clear, GitHub issue 1871. --- grid-view.c | 1 + 1 file changed, 1 insertion(+) diff --git a/grid-view.c b/grid-view.c index fa3bfbf6..a4bd5ba2 100644 --- a/grid-view.c +++ b/grid-view.c @@ -214,6 +214,7 @@ grid_view_delete_cells(struct grid *gd, u_int px, u_int py, u_int nx, u_int bg) sx = grid_view_x(gd, gd->sx); grid_move_cells(gd, px, px + nx, py, sx - px - nx, bg); + grid_clear(gd, sx - nx, py, px + nx - (sx - nx), 1, bg); } /* Convert cells into a string. */ -- cgit From 79f09b4d855b2339db2c859266135ab1b6368a61 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 5 Aug 2019 06:42:02 +0000 Subject: Add support for the SD (scroll down) escape sequence, GitHub issue 1861. --- input.c | 7 +++++++ screen-write.c | 25 +++++++++++++++++++++++++ tmux.h | 3 +++ tty-term.c | 1 + tty.c | 44 ++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 76 insertions(+), 4 deletions(-) diff --git a/input.c b/input.c index ff8d7a17..f37f8fd8 100644 --- a/input.c +++ b/input.c @@ -244,6 +244,7 @@ enum input_csi_type { INPUT_CSI_RM, INPUT_CSI_RM_PRIVATE, INPUT_CSI_SCP, + INPUT_CSI_SD, INPUT_CSI_SGR, INPUT_CSI_SM, INPUT_CSI_SM_PRIVATE, @@ -270,6 +271,7 @@ static const struct input_table_entry input_csi_table[] = { { 'M', "", INPUT_CSI_DL }, { 'P', "", INPUT_CSI_DCH }, { 'S', "", INPUT_CSI_SU }, + { 'T', "", INPUT_CSI_SD }, { 'X', "", INPUT_CSI_ECH }, { 'Z', "", INPUT_CSI_CBT }, { '`', "", INPUT_CSI_HPA }, @@ -1525,6 +1527,11 @@ input_csi_dispatch(struct input_ctx *ictx) if (n != -1) screen_write_scrollup(sctx, n, bg); break; + case INPUT_CSI_SD: + n = input_get(ictx, 0, 1, 1); + if (n != -1) + screen_write_scrolldown(sctx, n, bg); + break; case INPUT_CSI_TBC: switch (input_get(ictx, 0, 0, 0)) { case -1: diff --git a/screen-write.c b/screen-write.c index 98cdf158..66053eaf 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1088,6 +1088,31 @@ screen_write_scrollup(struct screen_write_ctx *ctx, u_int lines, u_int bg) ctx->scrolled += lines; } +/* Scroll down. */ +void +screen_write_scrolldown(struct screen_write_ctx *ctx, u_int lines, u_int bg) +{ + struct screen *s = ctx->s; + struct grid *gd = s->grid; + struct tty_ctx ttyctx; + u_int i; + + screen_write_initctx(ctx, &ttyctx); + ttyctx.bg = bg; + + if (lines == 0) + lines = 1; + else if (lines > s->rlower - s->rupper + 1) + lines = s->rlower - s->rupper + 1; + + for (i = 0; i < lines; i++) + grid_view_scroll_region_down(gd, s->rupper, s->rlower, bg); + + screen_write_collect_flush(ctx, 0); + ttyctx.num = lines; + tty_write(tty_cmd_scrolldown, &ttyctx); +} + /* Carriage return (cursor to start of line). */ void screen_write_carriagereturn(struct screen_write_ctx *ctx) diff --git a/tmux.h b/tmux.h index 5c10420a..9bf9f933 100644 --- a/tmux.h +++ b/tmux.h @@ -422,6 +422,7 @@ enum tty_code_code { TTYC_REV, TTYC_RGB, TTYC_RI, + TTYC_RIN, TTYC_RMACS, TTYC_RMCUP, TTYC_RMKX, @@ -1927,6 +1928,7 @@ void tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *); void tty_cmd_insertline(struct tty *, const struct tty_ctx *); void tty_cmd_linefeed(struct tty *, const struct tty_ctx *); void tty_cmd_scrollup(struct tty *, const struct tty_ctx *); +void tty_cmd_scrolldown(struct tty *, const struct tty_ctx *); void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *); void tty_cmd_setselection(struct tty *, const struct tty_ctx *); void tty_cmd_rawstring(struct tty *, const struct tty_ctx *); @@ -2303,6 +2305,7 @@ void screen_write_reverseindex(struct screen_write_ctx *, u_int); void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int); void screen_write_linefeed(struct screen_write_ctx *, int, u_int); void screen_write_scrollup(struct screen_write_ctx *, u_int, u_int); +void screen_write_scrolldown(struct screen_write_ctx *, u_int, u_int); void screen_write_carriagereturn(struct screen_write_ctx *); void screen_write_clearendofscreen(struct screen_write_ctx *, u_int); void screen_write_clearstartofscreen(struct screen_write_ctx *, u_int); diff --git a/tty-term.c b/tty-term.c index eabadf6b..182edd7d 100644 --- a/tty-term.c +++ b/tty-term.c @@ -242,6 +242,7 @@ static const struct tty_term_code_entry tty_term_codes[] = { [TTYC_REV] = { TTYCODE_STRING, "rev" }, [TTYC_RGB] = { TTYCODE_FLAG, "RGB" }, [TTYC_RI] = { TTYCODE_STRING, "ri" }, + [TTYC_RIN] = { TTYCODE_STRING, "rin" }, [TTYC_RMACS] = { TTYCODE_STRING, "rmacs" }, [TTYC_RMCUP] = { TTYCODE_STRING, "rmcup" }, [TTYC_RMKX] = { TTYCODE_STRING, "rmkx" }, diff --git a/tty.c b/tty.c index 024aef27..1658fb74 100644 --- a/tty.c +++ b/tty.c @@ -1558,10 +1558,11 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx) return; if (ctx->bigger || - !tty_pane_full_width(tty, ctx) || + (!tty_pane_full_width(tty, ctx) && !tty_use_margin(tty)) || tty_fake_bce(tty, wp, 8) || !tty_term_has(tty->term, TTYC_CSR) || - !tty_term_has(tty->term, TTYC_RI) || + (!tty_term_has(tty->term, TTYC_RI) && + !tty_term_has(tty->term, TTYC_RIN)) || ctx->wp->sx == 1 || ctx->wp->sy == 1) { tty_redraw_region(tty, ctx); @@ -1571,10 +1572,13 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx) tty_default_attributes(tty, wp, ctx->bg); tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); - tty_margin_off(tty); + tty_margin_pane(tty, ctx); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper); - tty_putcode(tty, TTYC_RI); + if (tty_term_has(tty->term, TTYC_RI)) + tty_putcode(tty, TTYC_RI); + else + tty_putcode1(tty, TTYC_RIN, 1); } void @@ -1652,6 +1656,38 @@ tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx) } } +void +tty_cmd_scrolldown(struct tty *tty, const struct tty_ctx *ctx) +{ + struct window_pane *wp = ctx->wp; + u_int i; + + if (ctx->bigger || + (!tty_pane_full_width(tty, ctx) && !tty_use_margin(tty)) || + tty_fake_bce(tty, wp, 8) || + !tty_term_has(tty->term, TTYC_CSR) || + (!tty_term_has(tty->term, TTYC_RI) && + !tty_term_has(tty->term, TTYC_RIN)) || + wp->sx == 1 || + wp->sy == 1) { + tty_redraw_region(tty, ctx); + return; + } + + tty_default_attributes(tty, wp, ctx->bg); + + tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); + tty_margin_pane(tty, ctx); + tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper); + + if (tty_term_has(tty->term, TTYC_RIN)) + tty_putcode1(tty, TTYC_RIN, ctx->num); + else { + for (i = 0; i < ctx->num; i++) + tty_putcode(tty, TTYC_RI); + } +} + void tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx) { -- cgit From 7e4439beb7a36919a029183506fb1f383217cbdd Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 1 Aug 2019 07:08:13 +0000 Subject: Remove check for same size - size has already been changed so this breaks reflow. --- grid.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/grid.c b/grid.c index f33eef72..2f1e9b59 100644 --- a/grid.c +++ b/grid.c @@ -1220,10 +1220,6 @@ grid_reflow(struct grid *gd, u_int sx) struct grid_cell gc; u_int yy, width, i, at, first; - /* Do not reflow to the same size. */ - if (sx == gd->sx) - return; - /* * Create a destination grid. This is just used as a container for the * line data and may not be fully valid. -- cgit From 5e4f3714084dc3edcc8f5e9bfcc86faeb92d900a Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 26 Aug 2019 16:35:41 +0000 Subject: Fix swap-window -d to work as intended, GitHub issue 1879 from Sam Stuewe. --- cmd-swap-window.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd-swap-window.c b/cmd-swap-window.c index f5224194..0c15479d 100644 --- a/cmd-swap-window.c +++ b/cmd-swap-window.c @@ -77,10 +77,10 @@ cmd_swap_window_exec(struct cmd *self, struct cmdq_item *item) wl_src->window = w_dst; TAILQ_INSERT_TAIL(&w_dst->winlinks, wl_src, wentry); - if (!args_has(self->args, 'd')) { - session_select(src, wl_src->idx); + if (args_has(self->args, 'd')) { + session_select(dst, wl_dst->idx); if (src != dst) - session_select(dst, wl_dst->idx); + session_select(src, wl_src->idx); } session_group_synchronize_from(src); server_redraw_session_group(src); -- cgit From c45b255a885f36e033e1dfba1776fb5c04bfb6cf Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 29 Aug 2019 07:13:48 +0000 Subject: It is not longer necessary to double-escape ; in %%%, problem reported by Theo Buehler. --- cmd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd.c b/cmd.c index 7c9d89c8..96cedc97 100644 --- a/cmd.c +++ b/cmd.c @@ -660,7 +660,7 @@ char * cmd_template_replace(const char *template, const char *s, int idx) { char ch, *buf; - const char *ptr, *cp, quote[] = "\"\\$"; + const char *ptr, *cp, quote[] = "\"\\$;"; int replaced, quoted; size_t len; @@ -691,10 +691,6 @@ cmd_template_replace(const char *template, const char *s, int idx) for (cp = s; *cp != '\0'; cp++) { if (quoted && strchr(quote, *cp) != NULL) buf[len++] = '\\'; - if (quoted && *cp == ';') { - buf[len++] = '\\'; - buf[len++] = '\\'; - } buf[len++] = *cp; } buf[len] = '\0'; -- cgit From 54670d898fd010831b785d003421fef847de6776 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 8 Sep 2019 21:29:22 +0100 Subject: Missing headers from compat/asprintf.c, from cyyever at outlook dot com. --- compat/asprintf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/asprintf.c b/compat/asprintf.c index 95d78430..187c19f0 100644 --- a/compat/asprintf.c +++ b/compat/asprintf.c @@ -19,8 +19,10 @@ #include #include #include +#include #include "compat.h" +#include "xmalloc.h" int asprintf(char **ret, const char *fmt, ...) -- cgit From 846d57e1b80e78416e0b82d59839eef8b8aea6f2 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 10 Sep 2019 19:35:34 +0000 Subject: Make client exit if pane where input is going is closed. --- window.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/window.c b/window.c index 409f1df5..254ccc83 100644 --- a/window.c +++ b/window.c @@ -1551,6 +1551,10 @@ window_pane_input_callback(struct client *c, int closed, void *data) wp = window_pane_find_by_id(cdata->wp); if (wp == NULL || closed || c->flags & CLIENT_DEAD) { + if (wp == NULL) + c->flags |= CLIENT_EXIT; + evbuffer_drain(evb, len); + c->stdin_callback = NULL; server_client_unref(c); -- cgit From f27cac585c4a34396b4ff2f7b0df9bad2019ffda Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 16 Sep 2019 09:00:56 +0100 Subject: Add to CHANGES. --- CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index ad50d54c..f4ff86d2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,10 @@ CHANGES FROM 2.9 to 3.0 +* xterm 348 now disables margins when resized, so send DECLRMM again after + resize. + +* Add support for the SD (scroll down) escape sequence. + * Expand arguments to C and s format modifiers to match the m modifier. * Add support for underscore colours (Setulc capability must be added with -- cgit