From 424f13fe13036e75b1c80e7751b81529f4cd8e15 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 10 Apr 2024 07:15:21 +0000 Subject: Do not get muddled and crash if focusing a pane that is exiting, reported by Saul Nogueras in GitHub issue 3776. --- window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window.c b/window.c index 43c272bc..d53c606e 100644 --- a/window.c +++ b/window.c @@ -474,7 +474,7 @@ window_pane_update_focus(struct window_pane *wp) struct client *c; int focused = 0; - if (wp != NULL) { + if (wp != NULL && (~wp->flags & PANE_EXITED)) { if (wp != wp->window->active) focused = 0; else { -- cgit v1.2.3 From c62a9ca16b8fa199904c7628f0cb95c50593af6f Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 10 Apr 2024 07:29:15 +0000 Subject: Correct handling of mouse up events (don't ignore all but the last released button), and always process down event for double click. From Rudy Dellomas III in GitHub issue 3919. --- server-client.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server-client.c b/server-client.c index 5680594a..15f8e890 100644 --- a/server-client.c +++ b/server-client.c @@ -626,6 +626,8 @@ server_client_check_mouse(struct client *c, struct key_event *event) } else if (MOUSE_RELEASE(m->b)) { type = UP; x = m->x, y = m->y, b = m->lb; + if (m->sgr_type == 'm') + b = m->sgr_b; log_debug("up at %u,%u", x, y); } else { if (c->flags & CLIENT_DOUBLECLICK) { @@ -646,7 +648,10 @@ server_client_check_mouse(struct client *c, struct key_event *event) log_debug("triple-click at %u,%u", x, y); goto have_event; } - } else { + } + + /* DOWN is the only remaining event type. */ + if (type == NOTYPE) { type = DOWN; x = m->x, y = m->y, b = m->b; log_debug("down at %u,%u", x, y); -- cgit v1.2.3 From 553d4cba794b4f81dd42ba139f8dfb54fcd13c16 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 10 Apr 2024 07:36:25 +0000 Subject: Add an option allow-set-title to forbid applications from changing the pane title, from someone in GitHub issue 3930. --- input.c | 4 +++- options-table.c | 8 ++++++++ tmux.1 | 6 ++++++ tmux.h | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/input.c b/input.c index b833b50e..2ae4b89a 100644 --- a/input.c +++ b/input.c @@ -2341,7 +2341,9 @@ input_exit_osc(struct input_ctx *ictx) switch (option) { case 0: case 2: - if (screen_set_title(sctx->s, p) && wp != NULL) { + if (wp != NULL && + options_get_number(wp->options, "allow-set-title") && + screen_set_title(sctx->s, p)) { notify_pane("pane-title-changed", wp); server_redraw_window_borders(wp->window); server_status_window(wp->window); diff --git a/options-table.c b/options-table.c index 8187ad08..fe460473 100644 --- a/options-table.c +++ b/options-table.c @@ -876,6 +876,14 @@ const struct options_table_entry options_table[] = { "to rename windows." }, + { .name = "allow-set-title", + .type = OPTIONS_TABLE_FLAG, + .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, + .default_num = 1, + .text = "Whether applications are allowed to use the escape sequence " + "to set the pane title." + }, + { .name = "alternate-screen", .type = OPTIONS_TABLE_FLAG, .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, diff --git a/tmux.1 b/tmux.1 index 186ffee0..a5102216 100644 --- a/tmux.1 +++ b/tmux.1 @@ -4750,6 +4750,12 @@ they will be allowed even if the pane is invisible. Allow programs in the pane to change the window name using a terminal escape sequence (\eek...\ee\e\e). .Pp +.It Xo Ic allow-set-title +.Op Ic on | off +.Xc +Allow programs in the pane to change the title using the terminal escape +sequences (\ee]2;...\ee\e\e or \ee]0;...\ee\e\e). +.Pp .It Xo Ic alternate-screen .Op Ic on | off .Xc diff --git a/tmux.h b/tmux.h index f61d1032..469d7f1c 100644 --- a/tmux.h +++ b/tmux.h @@ -850,7 +850,7 @@ struct screen_sel; struct screen_titles; struct screen { char *title; - char *path; + char *path; struct screen_titles *titles; struct grid *grid; /* grid data */ -- cgit v1.2.3