From 25060c3fa550c176f2f01881fb20f0a1a28dfe1c Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 8 Jul 2026 08:07:42 +0000 Subject: [PATCH 1/3] Fix empty argument to splitw/newp and add -k to copy-mode. --- cmd-copy-mode.c | 4 ++-- cmd-new-window.c | 2 +- cmd-split-window.c | 2 +- tmux.1 | 5 ++++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c index fce6d3fbd..cfa60f59f 100644 --- a/cmd-copy-mode.c +++ b/cmd-copy-mode.c @@ -30,8 +30,8 @@ const struct cmd_entry cmd_copy_mode_entry = { .name = "copy-mode", .alias = NULL, - .args = { "deHMqSs:t:u", 0, 0, NULL }, - .usage = "[-deHMqSu] [-s src-pane] " CMD_TARGET_PANE_USAGE, + .args = { "dekHMqSs:t:u", 0, 0, NULL }, + .usage = "[-dekHMqSu] [-s src-pane] " CMD_TARGET_PANE_USAGE, .source = { 's', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 }, diff --git a/cmd-new-window.c b/cmd-new-window.c index 6e6d70ccc..a54aaaa20 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -141,7 +141,7 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item) sc.cwd = args_get(args, 'c'); sc.flags = 0; - if (args_has(args, 'E')) + if (args_has(args, 'E') || (count == 1 && *args_string(args, 0) == '\0')) sc.flags |= SPAWN_EMPTY; if (args_has(args, 'd')) sc.flags |= SPAWN_DETACHED; diff --git a/cmd-split-window.c b/cmd-split-window.c index 276138c19..09cfbfa86 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -105,7 +105,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item) flags |= SPAWN_FULLSIZE; input = args_has(args, 'I'); - if (input) + if (input || (count == 1 && *args_string(args, 0) == '\0')) empty = 1; else empty = args_has(args, 'E'); diff --git a/tmux.1 b/tmux.1 index fcf702fee..593d4de06 100644 --- a/tmux.1 +++ b/tmux.1 @@ -2585,7 +2585,7 @@ The synopsis for the command is: .Bl -tag -width Ds .It Xo Ic copy\-mode -.Op Fl deHMqSu +.Op Fl dekHMqSu .Op Fl s Ar src\-pane .Op Fl t Ar target\-pane .Xc @@ -2625,6 +2625,9 @@ example with: bind PageUp copy\-mode \-eu bind PageDown copy\-mode \-ed .Ed +.Pp +.Fl k +kills the pane when the mode is exited. .El .Pp A number of preset arrangements of panes are available, these are called From ac723bf2df3d5c0ee29441a2857774094a009391 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 8 Jul 2026 08:15:49 +0000 Subject: [PATCH 2/3] Do not crash looking for next or previous session. GitHub issue 5344. --- server-fn.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server-fn.c b/server-fn.c index 585a01f9c..7560e9da2 100644 --- a/server-fn.c +++ b/server-fn.c @@ -435,6 +435,7 @@ server_destroy_session(struct session *s) { struct client *c; struct session *s_new = NULL, *cs_new = NULL, *use_s; + struct sort_criteria sort_crit = { .order = SORT_NAME }; int detach_on_destroy; detach_on_destroy = options_get_number(s->options, "detach-on-destroy"); @@ -443,9 +444,11 @@ server_destroy_session(struct session *s) else if (detach_on_destroy == 2) s_new = server_find_session(s, server_newer_detached_session); else if (detach_on_destroy == 3) - s_new = session_previous_session(s, NULL); + s_new = session_previous_session(s, &sort_crit); else if (detach_on_destroy == 4) - s_new = session_next_session(s, NULL); + s_new = session_next_session(s, &sort_crit); + if (s_new == s) + s_new = NULL; /* * If no suitable new session was found above, then look for any From dac6514147285e6a955b73787c036e00ef90c964 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 8 Jul 2026 08:21:53 +0000 Subject: [PATCH 3/3] Report the terminal's own theme to panes rather than guessing from the background. GitHub issue 5343 from Ayman Bagabas. --- window.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/window.c b/window.c index 31abdd398..109f002ff 100644 --- a/window.c +++ b/window.c @@ -2412,7 +2412,6 @@ window_pane_get_theme(struct window_pane *wp) { struct window *w; struct client *loop; - enum client_theme theme; int found_light = 0, found_dark = 0; if (wp == NULL) @@ -2420,14 +2419,9 @@ window_pane_get_theme(struct window_pane *wp) w = wp->window; /* - * Derive theme from pane background color, if it's not the default - * colour. + * Prefer a theme reported by an attached client with mode 2031 or DSR + * 996: the terminal knows its own light or dark mode. */ - theme = colour_totheme(window_pane_get_bg(wp)); - if (theme != THEME_UNKNOWN) - return (theme); - - /* Try to find a client that has a theme. */ TAILQ_FOREACH(loop, &clients, entry) { if (loop->flags & CLIENT_UNATTACHEDFLAGS) continue; @@ -2444,12 +2438,16 @@ window_pane_get_theme(struct window_pane *wp) break; } } - if (found_dark && !found_light) return (THEME_DARK); if (found_light && !found_dark) return (THEME_LIGHT); - return (THEME_UNKNOWN); + + /* + * Otherwise guess from the pane background colour, for terminals which + * do not report a theme themselves. + */ + return (colour_totheme(window_pane_get_bg(wp))); } void