From cf63465eb08a658d1e7ec5fd1e1f70869117d3e9 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 12 Jun 2020 07:10:43 +0000 Subject: Fix quoting with newlines and single quotes. --- arguments.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/arguments.c b/arguments.c index 0495aa0e..dd92a952 100644 --- a/arguments.c +++ b/arguments.c @@ -212,32 +212,35 @@ args_print(struct args *args) char * args_escape(const char *s) { - static const char quoted[] = " #\"';${}"; + static const char dquoted[] = " #';${}"; + static const char squoted[] = " \""; char *escaped, *result; - int flags; + int flags, quotes = 0; if (*s == '\0') { xasprintf(&result, "''"); return (result); } + if (s[strcspn(s, dquoted)] != '\0') + quotes = '"'; + else if (s[strcspn(s, squoted)] != '\0') + quotes = '\''; + if (s[0] != ' ' && - (strchr(quoted, s[0]) != NULL || s[0] == '~') && - s[1] == '\0') { + s[1] == '\0' && + (quotes != 0 || s[0] == '~')) { xasprintf(&escaped, "\\%c", s[0]); return (escaped); } - if (strchr(s, ' ') != NULL && strchr(s, '\'') == NULL) { - xasprintf(&escaped, "'%s'", s); - return (escaped); - } - flags = VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL; - if (s[strcspn(s, quoted)] != '\0') + if (quotes == '"') flags |= VIS_DQ; utf8_stravis(&escaped, s, flags); - if (flags & VIS_DQ) { + if (quotes == '\'') + xasprintf(&result, "'%s'", escaped); + else if (quotes == '"') { if (*escaped == '~') xasprintf(&result, "\"\\%s\"", escaped); else -- cgit From 4c3bdc5a3619c2ea7d9b130efeebf12bf08a1fb2 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 12 Jun 2020 07:52:38 +0000 Subject: move-pane also defaults to marked pane now, reported by Ben Challenor. --- tmux.1 | 1 + 1 file changed, 1 insertion(+) diff --git a/tmux.1 b/tmux.1 index d3e0d0b3..207fa47c 100644 --- a/tmux.1 +++ b/tmux.1 @@ -2643,6 +2643,7 @@ The marked pane is the default target for .Fl s to .Ic join-pane , +.Ic move-pane , .Ic swap-pane and .Ic swap-window . -- cgit From d8d77691043a5ecd504fb2a82e4e312d947ab19f Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 12 Jun 2020 08:35:01 +0000 Subject: Check if a pane needs to be paused when output is written rather than just when it is queued. --- control.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/control.c b/control.c index 8ff7736f..05093d94 100644 --- a/control.c +++ b/control.c @@ -569,6 +569,13 @@ control_write_pending(struct client *c, struct control_pane *cp, size_t limit) } while (used != limit && !TAILQ_EMPTY(&cp->blocks)) { + if (control_check_age(c, wp, cp)) { + if (message != NULL) + evbuffer_free(message); + message = NULL; + break; + } + cb = TAILQ_FIRST(&cp->blocks); if (cb->t < t) age = t - cb->t; -- cgit