From e450416c93b95112640f61d81ea385dedcb14ef0 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 22 Jun 2020 12:55:10 +0100 Subject: [PATCH 1/9] 3.2-rc. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b5f65df5..b698526d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # configure.ac -AC_INIT([tmux], next-3.2) +AC_INIT([tmux], 3.2-rc) AC_PREREQ([2.60]) AC_CONFIG_AUX_DIR(etc) From e215a566a413dfd939c29bf5dbdb8aceeb25c136 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 23 Jun 2020 05:23:26 +0000 Subject: [PATCH 2/9] Use xvasprintf not vasprintf. --- format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/format.c b/format.c index 920dc4c0..c7c6b12e 100644 --- a/format.c +++ b/format.c @@ -224,7 +224,7 @@ format_log1(struct format_tree *ft, const char *from, const char *fmt, ...) return; va_start(ap, fmt); - vasprintf(&s, fmt, ap); + xvasprintf(&s, fmt, ap); va_end(ap); log_debug("%s: %s", from, s); From 43295bd4a5050b7571a26a242828bb2b8c85fd84 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 23 Jun 2020 14:10:43 +0000 Subject: [PATCH 3/9] Correctly redraw pane border bottom line when the status line is on and at the bottom, reported by Kaushal Modi. --- screen-redraw.c | 44 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/screen-redraw.c b/screen-redraw.c index 002970e9..258c2fd2 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -28,6 +28,8 @@ static void screen_redraw_draw_panes(struct screen_redraw_ctx *); static void screen_redraw_draw_status(struct screen_redraw_ctx *); static void screen_redraw_draw_pane(struct screen_redraw_ctx *, struct window_pane *); +static void screen_redraw_set_context(struct client *, + struct screen_redraw_ctx *); #define CELL_INSIDE 0 #define CELL_LEFTRIGHT 1 @@ -251,6 +253,10 @@ screen_redraw_type_of_cell(struct client *c, u_int px, u_int py, u_int sx = w->sx, sy = w->sy; int borders = 0; + /* Is this outside the window? */ + if (px >= sx || py >= sy) + return (CELL_OUTSIDE); + /* * Construct a bitmask of whether the cells to the left (bit 4), right, * top, and bottom (bit 1) of this cell are borders. @@ -263,13 +269,16 @@ screen_redraw_type_of_cell(struct client *c, u_int px, u_int py, if (py != 0 && screen_redraw_cell_border(c, px, py - 1, pane_status)) borders |= 2; + if (screen_redraw_cell_border(c, px, py + 1, pane_status)) + borders |= 1; } else { if (py == 0 || screen_redraw_cell_border(c, px, py - 1, pane_status)) - borders |= 2; + borders |= 2; + if (py != sy - 1 && + screen_redraw_cell_border(c, px, py + 1, pane_status)) + borders |= 1; } - if (py <= sy && screen_redraw_cell_border(c, px, py + 1, pane_status)) - borders |= 1; /* * Figure out what kind of border this cell is. Only one bit set @@ -315,7 +324,7 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py, int pane_status, *wpp = NULL; - if (px > w->sx || py > w->sy) + if (px >= w->sx || py >= w->sy) return (CELL_OUTSIDE); if (px == w->sx || py == w->sy) /* window border */ return (screen_redraw_type_of_cell(c, px, py, pane_status)); @@ -383,14 +392,16 @@ screen_redraw_check_is(u_int px, u_int py, int pane_status, /* Update pane status. */ static int -screen_redraw_make_pane_status(struct client *c, struct window *w, - struct window_pane *wp, int pane_lines) +screen_redraw_make_pane_status(struct client *c, struct window_pane *wp, + struct screen_redraw_ctx *rctx, int pane_lines) { + struct window *w = wp->window; struct grid_cell gc; const char *fmt; struct format_tree *ft; char *expanded; - u_int width, i; + int pane_status = rctx->pane_status; + u_int width, i, cell_type, top, px, py; struct screen_write_ctx ctx; struct screen old; @@ -415,9 +426,20 @@ screen_redraw_make_pane_status(struct client *c, struct window *w, screen_write_start(&ctx, &wp->status_screen); - screen_redraw_border_set(wp, pane_lines, CELL_TOPBOTTOM, &gc); - for (i = 0; i < width; i++) + if (rctx->statustop) + top = rctx->statuslines; + else + top = 0; + for (i = 0; i < width; i++) { + px = wp->xoff + 2 + i; + if (rctx->pane_status == PANE_STATUS_TOP) + py = top + wp->yoff - 1; + else + py = top + wp->yoff + wp->sy; + cell_type = screen_redraw_type_of_cell(c, px, py, pane_status); + screen_redraw_border_set(wp, pane_lines, cell_type, &gc); screen_write_cell(&ctx, &gc); + } gc.attr &= ~GRID_ATTR_CHARSET; screen_write_cursormove(&ctx, 0, 0, 0); @@ -504,6 +526,7 @@ screen_redraw_update(struct client *c, int flags) struct window_pane *wp; struct options *wo = w->options; int redraw, lines; + struct screen_redraw_ctx ctx; if (c->message_string != NULL) redraw = status_message_redraw(c); @@ -518,10 +541,11 @@ screen_redraw_update(struct client *c, int flags) flags |= CLIENT_REDRAWOVERLAY; if (options_get_number(wo, "pane-border-status") != PANE_STATUS_OFF) { + screen_redraw_set_context(c, &ctx); lines = options_get_number(wo, "pane-border-lines"); redraw = 0; TAILQ_FOREACH(wp, &w->panes, entry) { - if (screen_redraw_make_pane_status(c, w, wp, lines)) + if (screen_redraw_make_pane_status(c, wp, &ctx, lines)) redraw = 1; } if (redraw) From 6cacaa94a5132ba80ee9a7a733aff5fe580ab117 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 25 Jun 2020 08:56:02 +0000 Subject: [PATCH 4/9] Silently ignore -a or -b if the window index doesn't exist and create using that index (this is how it used to work), reported by Romain Francoise. --- cmd-new-window.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd-new-window.c b/cmd-new-window.c index 0b24474b..ca3e66c4 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -68,10 +68,8 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item) before = args_has(args, 'b'); if (args_has(args, 'a') || before) { idx = winlink_shuffle_up(s, wl, before); - if (idx == -1) { - cmdq_error(item, "couldn't get a window index"); - return (CMD_RETURN_ERROR); - } + if (idx == -1) + idx = target->idx; } memset(&sc, 0, sizeof sc); @@ -114,7 +112,7 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item) if ((template = args_get(args, 'F')) == NULL) template = NEW_WINDOW_TEMPLATE; cp = format_single(item, template, tc, s, new_wl, - new_wl->window->active); + new_wl->window->active); cmdq_print(item, "%s", cp); free(cp); } From c9b4d5a4a5c98d9d0a074800b5291d3c8b02f4b1 Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 27 Jun 2020 10:19:59 +0000 Subject: [PATCH 5/9] Fix 0x Unicode character parsing, GitHub issue 2286. --- key-string.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/key-string.c b/key-string.c index 4ee12145..6f4fd2ac 100644 --- a/key-string.c +++ b/key-string.c @@ -18,7 +18,9 @@ #include +#include #include +#include #include "tmux.h" @@ -163,13 +165,13 @@ key_code key_string_lookup_string(const char *string) { static const char *other = "!#()+,-.0123456789:;<=>'\r\t"; - key_code key; - u_int u; - key_code modifiers; - struct utf8_data ud; - u_int i; + key_code key, modifiers; + u_int u, i; + struct utf8_data ud, *udp; enum utf8_state more; utf8_char uc; + char m[MB_LEN_MAX + 1]; + int mlen; /* Is this no key or any key? */ if (strcasecmp(string, "None") == 0) @@ -181,9 +183,21 @@ key_string_lookup_string(const char *string) if (string[0] == '0' && string[1] == 'x') { if (sscanf(string + 2, "%x", &u) != 1) return (KEYC_UNKNOWN); - if (u > 0x1fffff) - return (KEYC_UNKNOWN); - return (u); + mlen = wctomb(m, u); + if (mlen <= 0 || mlen > MB_LEN_MAX) + return (KEYC_UNKNOWN); + m[mlen] = '\0'; + + udp = utf8_fromcstr(m); + if (udp == NULL || + udp[0].size == 0 || + udp[1].size != 0 || + utf8_from_data(&udp[0], &uc) != UTF8_DONE) { + free(udp); + return (KEYC_UNKNOWN); + } + free(udp); + return (uc); } /* Check for modifiers. */ From 629ba1b83892ad373dd5b88268969d4cde857f22 Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 27 Jun 2020 10:23:10 +0000 Subject: [PATCH 6/9] Check for no pane border status line separately from top/bottom. --- screen-redraw.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/screen-redraw.c b/screen-redraw.c index 258c2fd2..3391a891 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -271,13 +271,19 @@ screen_redraw_type_of_cell(struct client *c, u_int px, u_int py, borders |= 2; if (screen_redraw_cell_border(c, px, py + 1, pane_status)) borders |= 1; - } else { + } else if (pane_status == PANE_STATUS_BOTTOM) { if (py == 0 || screen_redraw_cell_border(c, px, py - 1, pane_status)) borders |= 2; if (py != sy - 1 && screen_redraw_cell_border(c, px, py + 1, pane_status)) borders |= 1; + } else { + if (py == 0 || + screen_redraw_cell_border(c, px, py - 1, pane_status)) + borders |= 2; + if (screen_redraw_cell_border(c, px, py + 1, pane_status)) + borders |= 1; } /* From 83868ceb1a18013578265591cea7c04a6e0f0516 Mon Sep 17 00:00:00 2001 From: bket Date: Mon, 29 Jun 2020 15:53:28 +0000 Subject: [PATCH 7/9] Replace TAILQ concatenation loop with TAILQ_CONCAT As a result remove unneeded variables OK @nicm --- cmd.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd.c b/cmd.c index 7e7cac4d..775bdb73 100644 --- a/cmd.c +++ b/cmd.c @@ -597,12 +597,7 @@ cmd_list_append(struct cmd_list *cmdlist, struct cmd *cmd) void cmd_list_move(struct cmd_list *cmdlist, struct cmd_list *from) { - struct cmd *cmd, *cmd1; - - TAILQ_FOREACH_SAFE(cmd, from->list, qentry, cmd1) { - TAILQ_REMOVE(from->list, cmd, qentry); - TAILQ_INSERT_TAIL(cmdlist->list, cmd, qentry); - } + TAILQ_CONCAT(cmdlist->list, from->list, qentry); cmdlist->group = cmd_list_next_group++; } From 0d0fc13aaaea2fc32d39ea8cd5564dbadb40c718 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 3 Jul 2020 07:00:12 +0000 Subject: [PATCH 8/9] Check if client is NULL before using it, GitHub issue 2295. --- cmd-select-pane.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd-select-pane.c b/cmd-select-pane.c index 313deefe..b0c78d74 100644 --- a/cmd-select-pane.c +++ b/cmd-select-pane.c @@ -205,7 +205,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item) return (CMD_RETURN_NORMAL); } - if (c->session != NULL && (c->flags & CLIENT_ACTIVEPANE)) + if (c != NULL && c->session != NULL && (c->flags & CLIENT_ACTIVEPANE)) activewp = server_client_get_pane(c); else activewp = w->active; @@ -214,7 +214,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item) if (window_push_zoom(w, args_has(args, 'Z'))) server_redraw_window(w); window_redraw_active_switch(w, wp); - if (c->session != NULL && (c->flags & CLIENT_ACTIVEPANE)) + if (c != NULL && c->session != NULL && (c->flags & CLIENT_ACTIVEPANE)) server_client_set_pane(c, wp); else if (window_set_active_pane(w, wp, 1)) cmd_find_from_winlink_pane(current, wl, wp, 0); From 5661346c41fc176c29cc829c177c718ee1775d93 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 3 Jul 2020 07:07:50 +0000 Subject: [PATCH 9/9] Missing word, from annihilannic at hotmail dot com, GitHub issue 2288. --- tmux.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmux.1 b/tmux.1 index ca470ea2..3441e71b 100644 --- a/tmux.1 +++ b/tmux.1 @@ -2947,7 +2947,7 @@ specifies a prefix to print before each key and .Fl 1 lists only the first matching key. .Fl a -lists the command for keys that do have a note rather than skipping them. +lists the command for keys that do not have a note rather than skipping them. .It Xo Ic send-keys .Op Fl FHlMRX .Op Fl N Ar repeat-count