From 3c65475561b25073c3b7dcbb0b6498a0535ecd59 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 19 Jul 2022 06:46:57 +0000 Subject: Fix memory leak, from Gabriel Souza Franco. --- format.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/format.c b/format.c index edf4217c..535af061 100644 --- a/format.c +++ b/format.c @@ -3564,12 +3564,12 @@ found: } if (modifiers & FORMAT_QUOTE_SHELL) { saved = found; - found = xstrdup(format_quote_shell(saved)); + found = format_quote_shell(saved); free(saved); } if (modifiers & FORMAT_QUOTE_STYLE) { saved = found; - found = xstrdup(format_quote_style(saved)); + found = format_quote_style(saved); free(saved); } return (found); -- cgit From 86dfbda0e4a2ad2638a5beed41dc4b441857362b Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 19 Jul 2022 06:51:31 +0000 Subject: Process modifiers as bits rather than using a switch, from Koichi Murase. --- tty-keys.c | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/tty-keys.c b/tty-keys.c index 4a712d42..bb9ec231 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -934,34 +934,16 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len, nkey = number; /* Update the modifiers. */ - switch (modifiers) { - case 2: - nkey |= KEYC_SHIFT; - break; - case 3: - nkey |= (KEYC_META|KEYC_IMPLIED_META); - break; - case 4: - nkey |= (KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META); - break; - case 5: - nkey |= KEYC_CTRL; - break; - case 6: - nkey |= (KEYC_SHIFT|KEYC_CTRL); - break; - case 7: - nkey |= (KEYC_META|KEYC_CTRL); - break; - case 8: - nkey |= (KEYC_SHIFT|KEYC_META|KEYC_IMPLIED_META|KEYC_CTRL); - break; - case 9: - nkey |= (KEYC_META|KEYC_IMPLIED_META); - break; - default: - *key = KEYC_NONE; - break; + if (modifiers > 0) { + modifiers--; + if (modifiers & 1) + nkey |= KEYC_SHIFT; + if (modifiers & 2) + nkey |= (KEYC_META|KEYC_IMPLIED_META); /* Alt */ + if (modifiers & 4) + nkey |= KEYC_CTRL; + if (modifiers & 8) + nkey |= (KEYC_META|KEYC_IMPLIED_META); /* Meta */ } /* -- cgit From ee431d482a8dac52f4fb16de1038e819a9e42b9a Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 19 Jul 2022 07:10:13 +0000 Subject: Do not ignore the "off" flag when checking if a pane should be stopped, GitHub issue 3250. --- server-client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server-client.c b/server-client.c index 864b37b3..4109c1df 100644 --- a/server-client.c +++ b/server-client.c @@ -2221,7 +2221,8 @@ server_client_check_pane_buffer(struct window_pane *wp) } wpo = control_pane_offset(c, wp, &flag); if (wpo == NULL) { - off = 0; + if (!flag) + off = 0; continue; } if (!flag) -- cgit