From e7a530fe4c0f8e0f807daf6a1b80d86c67c93e1b Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 28 May 2019 15:48:31 +0100 Subject: Next will be 3.1. --- CHANGES | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 097d7228..56bf28b0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +CHANGES FROM 3.0 to X.X + +XXX + CHANGES FROM 2.9 to 3.0 * Add an addition form of string syntax in the configuration file - {}. This diff --git a/configure.ac b/configure.ac index 2c1a8945..5fba1eaf 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # configure.ac -AC_INIT([tmux], 3.0-rc) +AC_INIT([tmux], next-3.1) AC_PREREQ([2.60]) AC_CONFIG_AUX_DIR(etc) -- cgit From 4382538e4bac2849262710c447e4b630e7f34bd7 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 28 May 2019 18:30:30 +0000 Subject: Do not read past the end of the argument string if it is empty. --- arguments.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arguments.c b/arguments.c index 68690deb..54bc3593 100644 --- a/arguments.c +++ b/arguments.c @@ -211,6 +211,8 @@ args_escape(const char *s) char *escaped, *result; int flags; + if (*s == '\0') + return (xstrdup(s)); if ((strchr(quoted, s[0]) != NULL || s[0] == '~') && s[1] == '\0') { xasprintf(&escaped, "\\%c", s[0]); return (escaped); -- cgit From 580cd16f4c3474d7cae867b9b24f01665a268e9d Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 28 May 2019 18:53:36 +0000 Subject: Redraw status line if size changes, GitHub issue 1762. Also fix length of target buffer when pasting into status line. --- status.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/status.c b/status.c index ce36cc3c..0f96f0d3 100644 --- a/status.c +++ b/status.c @@ -348,10 +348,8 @@ status_redraw(struct client *c) /* Resize the target screen. */ if (screen_size_x(&sl->screen) != width || screen_size_y(&sl->screen) != lines) { - if (screen_size_x(&sl->screen) != width) - force = 1; screen_resize(&sl->screen, width, lines, 0); - changed = 1; + changed = force = 1; } screen_write_start(&ctx, NULL, &sl->screen); @@ -865,7 +863,7 @@ status_prompt_paste(struct client *c) if ((pb = paste_get_top(NULL)) == NULL) return (0); bufdata = paste_buffer_data(pb, &bufsize); - ud = xreallocarray(NULL, bufsize, sizeof *ud); + ud = xreallocarray(NULL, bufsize + 1, sizeof *ud); udp = ud; for (i = 0; i != bufsize; /* nothing */) { more = utf8_open(udp, bufdata[i]); -- cgit From a4424fbebf929f4ad742200365fc330a26a65d7f Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 29 May 2019 10:08:36 +0000 Subject: Support \ooo escapes, from Avi Halachmi. --- cmd-parse.y | 26 ++++++++++++++++++++++++-- tmux.1 | 6 +++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/cmd-parse.y b/cmd-parse.y index f347280b..739ca56c 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -1083,12 +1083,34 @@ error: static int yylex_token_escape(char **buf, size_t *len) { - int ch, type; + int ch, type, o2, o3; u_int size, i, tmp; char s[9]; struct utf8_data ud; - switch (ch = yylex_getc()) { + ch = yylex_getc(); + + if (ch >= '4' && ch <= '7') { + yyerror("invalid octal escape"); + return (0); + } + if (ch >= '0' && ch <= '3') { + o2 = yylex_getc(); + if (o2 >= '0' && o2 <= '7') { + o3 = yylex_getc(); + if (o3 >= '0' && o3 <= '7') { + ch = 64 * (ch - '0') + + 8 * (o2 - '0') + + (o3 - '0'); + yylex_append1(buf, len, ch); + return (1); + } + } + yyerror("invalid octal escape"); + return (0); + } + + switch (ch) { case EOF: return (0); case 'e': diff --git a/tmux.1 b/tmux.1 index b4e27c40..dfdd96b4 100644 --- a/tmux.1 +++ b/tmux.1 @@ -515,7 +515,11 @@ the given four or eight digit hexadecimal number. When preceded (escaped) by a \e, the following characters are replaced: \ee by the escape character; \er by a carriage return; \en by a newline; and \et by a tab. -.Pp +.It +\eooo is replaced by a character of the octal value ooo. +Three octal digits are required, for example \e001. +The largest valid character is \e377. +.It Any other characters preceded by \e are replaced by themselves (that is, the \e is removed) and are not treated as having any special meaning - so for example \e; will not mark a command sequence and \e$ will not expand an environment -- cgit From 409d52ed411cbc4f8e52ff3dfd02199c9f998a51 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 29 May 2019 14:19:26 +0100 Subject: Try OS X. --- .travis.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2188eec0..ab333aa4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,18 @@ +os: + - linux + - osx + language: c + matrix: include: - compiler: gcc - compiler: clang - env: CFLAGS="-g -O2" + before_install: - - sudo apt-get update -qq - - sudo apt-get -y install bison debhelper autotools-dev dh-autoreconf file libncurses5-dev libevent-dev pkg-config libutempter-dev build-essential -script: (CFLAGS= ./autogen.sh) && ./configure --enable-debug && make + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get -y install bison autotools-dev libncurses5-dev libevent-dev pkg-config libutempter-dev build-essential; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi + +script: + - ./autogen.sh && ./configure && make -- cgit From 4425c1e1b337b8b72896ba6ecbc5402ea08e4e8a Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 29 May 2019 14:24:09 +0100 Subject: Tweak again. --- .travis.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index ab333aa4..578c7f43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,12 @@ +language: c + os: - linux - osx -language: c - -matrix: - include: - - compiler: gcc - - compiler: clang +compiler: + - gcc + - clang before_install: - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq; fi -- cgit From 2ce8e0110cfbc2505cd369895d5bb153c3f4e3d8 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 29 May 2019 14:32:49 +0100 Subject: Don't even need this? --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 578c7f43..fd85bf61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ compiler: before_install: - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get -y install bison autotools-dev libncurses5-dev libevent-dev pkg-config libutempter-dev build-essential; fi - - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi script: - ./autogen.sh && ./configure && make -- cgit From c17edd594e8088d2355102a8ca58f4b256c59397 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 29 May 2019 19:34:42 +0000 Subject: The line number needs to be updated only after the \n is processed by the parser, so store a flag and update it next time around. Also each new line needs its own shared data. --- cmd-parse.y | 7 ++++++- cmd-queue.c | 28 ++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/cmd-parse.y b/cmd-parse.y index 739ca56c..a235fde1 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -58,6 +58,7 @@ struct cmd_parse_state { size_t len; size_t off; + int eol; int eof; struct cmd_parse_input *input; u_int escapes; @@ -933,6 +934,10 @@ yylex(void) char *token, *cp; int ch, next; + if (ps->eol) + ps->input->line++; + ps->eol = 0; + for (;;) { ch = yylex_getc(); @@ -959,7 +964,7 @@ yylex(void) /* * End of line. Update the line number. */ - ps->input->line++; + ps->eol = 1; return ('\n'); } diff --git a/cmd-queue.c b/cmd-queue.c index f08d7c02..93dcaa53 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -203,16 +203,20 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current, struct cmdq_item *item, *first = NULL, *last = NULL; struct cmd *cmd; struct cmdq_shared *shared; - - shared = xcalloc(1, sizeof *shared); - if (current != NULL) - cmd_find_copy_state(&shared->current, current); - else - cmd_find_clear_state(&shared->current, 0); - if (m != NULL) - memcpy(&shared->mouse, m, sizeof shared->mouse); + u_int group = 0; TAILQ_FOREACH(cmd, &cmdlist->list, qentry) { + if (cmd->group != group) { + shared = xcalloc(1, sizeof *shared); + if (current != NULL) + cmd_find_copy_state(&shared->current, current); + else + cmd_find_clear_state(&shared->current, 0); + if (m != NULL) + memcpy(&shared->mouse, m, sizeof shared->mouse); + group = cmd->group; + } + item = xcalloc(1, sizeof *item); xasprintf(&item->name, "[%s/%p]", cmd->entry->name, item); item->type = CMDQ_COMMAND; @@ -263,12 +267,20 @@ static enum cmd_retval cmdq_fire_command(struct cmdq_item *item) { struct client *c = item->client; + const char *name = cmdq_name(c); struct cmdq_shared *shared = item->shared; struct cmd *cmd = item->cmd; const struct cmd_entry *entry = cmd->entry; enum cmd_retval retval; struct cmd_find_state *fsp, fs; int flags; + char *tmp; + + if (log_get_level() > 1) { + tmp = cmd_print(cmd); + log_debug("%s %s: (%u) %s", __func__, name, item->group, tmp); + free(tmp); + } flags = !!(shared->flags & CMDQ_SHARED_CONTROL); cmdq_guard(item, "begin", flags); -- cgit From 7dced376737ef685e09fd5a49161ca2bf423e91b Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 29 May 2019 20:05:14 +0000 Subject: Use VIS_CSTYLE for the arguments and add the missing escapes it can generate to the parser. --- arguments.c | 2 +- cmd-parse.y | 15 +++++++++++++++ tty-term.c | 2 +- window-buffer.c | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/arguments.c b/arguments.c index 54bc3593..8e049aab 100644 --- a/arguments.c +++ b/arguments.c @@ -218,7 +218,7 @@ args_escape(const char *s) return (escaped); } - flags = VIS_OCTAL|VIS_TAB|VIS_NL; + flags = VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL; if (s[strcspn(s, quoted)] != '\0') flags |= VIS_DQ; utf8_stravis(&escaped, s, flags); diff --git a/cmd-parse.y b/cmd-parse.y index a235fde1..a623caa5 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -1118,9 +1118,24 @@ yylex_token_escape(char **buf, size_t *len) switch (ch) { case EOF: return (0); + case 'a': + ch = '\a'; + break; + case 'b': + ch = '\b'; + break; case 'e': ch = '\033'; break; + case 'f': + ch = '\f'; + break; + case 's': + ch = ' '; + break; + case 'v': + ch = '\v'; + break; case 'r': ch = '\r'; break; diff --git a/tty-term.c b/tty-term.c index 45934afa..83bfcdc1 100644 --- a/tty-term.c +++ b/tty-term.c @@ -685,7 +685,7 @@ tty_term_describe(struct tty_term *term, enum tty_code_code code) break; case TTYCODE_STRING: strnvis(out, term->codes[code].value.string, sizeof out, - VIS_OCTAL|VIS_TAB|VIS_NL); + VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL); xsnprintf(s, sizeof s, "%4u: %s: (string) %s", code, tty_term_codes[code].name, out); diff --git a/window-buffer.c b/window-buffer.c index 79dacf97..983b1680 100644 --- a/window-buffer.c +++ b/window-buffer.c @@ -246,7 +246,7 @@ window_buffer_draw(__unused void *modedata, void *itemdata, at = 0; while (end != pdata + psize && *end != '\n') { if ((sizeof line) - at > 5) { - cp = vis(line + at, *end, VIS_TAB|VIS_OCTAL, 0); + cp = vis(line + at, *end, VIS_OCTAL|VIS_TAB, 0); at = cp - line; } end++; -- cgit From 026450c1a8ed64e49521bec676e2e1faba64c1aa Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 30 May 2019 07:52:24 +0100 Subject: Add test for xenl terminals. --- regress/command-order.sh | 6 ++---- regress/xenl-terminal.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 regress/xenl-terminal.sh diff --git a/regress/command-order.sh b/regress/command-order.sh index fb4e0324..04046f0d 100644 --- a/regress/command-order.sh +++ b/regress/command-order.sh @@ -1,7 +1,5 @@ #!/bin/sh -# new-session without clients should be the right size - PATH=/bin:/usr/bin TERM=screen @@ -19,6 +17,7 @@ EOF $TMUX -f$TMP start $TMP || exit 1 +$TMUX kill-server 2>/dev/null cat </dev/null cat <$TMP new -sfoo -nfoo0 @@ -40,6 +38,7 @@ EOF $TMUX -f$TMP start $TMP || exit 1 +$TMUX kill-server 2>/dev/null cat </dev/null exit 0 diff --git a/regress/xenl-terminal.sh b/regress/xenl-terminal.sh new file mode 100644 index 00000000..07469ceb --- /dev/null +++ b/regress/xenl-terminal.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +PATH=/bin:/usr/bin +TERM=screen + +[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux) +TMUX="$TEST_TMUX -Ltest" +$TMUX kill-server 2>/dev/null +TMUX2="$TEST_TMUX -Ltest2" +$TMUX2 kill-server 2>/dev/null + +TMP=$(mktemp) +trap "rm -f $TMP" 0 1 15 + +$TMUX2 -f/dev/null new -d || exit 1 +$TMUX2 set -as terminal-overrides ',*:xenl@' || exit 1 +$TMUX2 set -g status-right 'RRR' || exit 1 +$TMUX2 set -g status-left 'LLL' || exit 1 +$TMUX2 set -g window-status-current-format 'WWW' || exit 1 +$TMUX -f/dev/null new -x20 -y2 -d "$TMUX2 attach" || exit 1 +sleep 1 +$TMUX capturep -p|tail -1 >$TMP || exit 1 +$TMUX kill-server 2>/dev/null +$TMUX2 kill-server 2>/dev/null +cat < Date: Thu, 30 May 2019 07:42:41 +0000 Subject: I had hoped that non-xenl terminals had died out, at least in fairly modern OSs, but no - DragonFly BSD's console returns to haunt us. Fix it at least somewhat. GitHub issue 1763. --- tmux.1 | 2 +- tty.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tmux.1 b/tmux.1 index dfdd96b4..d9b37c0e 100644 --- a/tmux.1 +++ b/tmux.1 @@ -4325,7 +4325,7 @@ Align text to the left, centre or right of the available space if appropriate. .It Xo Ic list=on , .Ic list=focus , .Ic list=left-marker , -.Ic list=right=marker , +.Ic list=right-marker , .Ic nolist .Xc Mark the position of the various window list components in the diff --git a/tty.c b/tty.c index 34403a1f..05df4f0f 100644 --- a/tty.c +++ b/tty.c @@ -527,6 +527,12 @@ tty_putc(struct tty *tty, u_char ch) { const char *acs; + if ((tty->term->flags & TERM_EARLYWRAP) && + ch >= 0x20 && ch != 0x7f && + tty->cy == tty->sy - 1 && + tty->cx + 1 >= tty->sx) + return; + if (tty->cell.attr & GRID_ATTR_CHARSET) { acs = tty_acs_get(tty, ch); if (acs != NULL) @@ -557,6 +563,11 @@ tty_putc(struct tty *tty, u_char ch) void tty_putn(struct tty *tty, const void *buf, size_t len, u_int width) { + if ((tty->term->flags & TERM_EARLYWRAP) && + tty->cy == tty->sy - 1 && + tty->cx + len >= tty->sx) + len = tty->sx - tty->cx - 1; + tty_add(tty, buf, len); if (tty->cx + width > tty->sx) { tty->cx = (tty->cx + width) - tty->sx; -- cgit From 8fb796b5b3fbd7ff430d1b6ad2a49f97feea8f3c Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 30 May 2019 10:04:33 +0000 Subject: No longer need to reduce line number by one. --- cmd-parse.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd-parse.y b/cmd-parse.y index a623caa5..d5d12d95 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -361,7 +361,7 @@ command : assignment TOKEN $$ = xcalloc(1, sizeof *$$); $$->name = $2; - $$->line = ps->input->line - 1; + $$->line = ps->input->line; } | assignment TOKEN arguments @@ -370,7 +370,7 @@ command : assignment TOKEN $$ = xcalloc(1, sizeof *$$); $$->name = $2; - $$->line = ps->input->line - 1; + $$->line = ps->input->line; $$->argc = $3.argc; $$->argv = $3.argv; -- cgit From b26523c26dc7cf0a24a1adb787aa1816deb40693 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 30 May 2019 20:54:03 +0000 Subject: Remove a leftover abort and some fixes from cppcheck. --- cmd-display-message.c | 3 +-- input.c | 1 - mode-tree.c | 2 +- options.c | 3 ++- window.c | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd-display-message.c b/cmd-display-message.c index 8c1ad5f6..4d9bccb6 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -109,8 +109,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) format_defaults(ft, target_c, s, wl, wp); if (args_has(args, 'a')) { - if (item != NULL) - format_each(ft, cmd_display_message_each, item); + format_each(ft, cmd_display_message_each, item); return (CMD_RETURN_NORMAL); } diff --git a/input.c b/input.c index 4095c05d..e54b5ac0 100644 --- a/input.c +++ b/input.c @@ -2409,7 +2409,6 @@ input_osc_52(struct input_ctx *ictx, const char *p) outlen = 4 * ((len + 2) / 3) + 1; out = xmalloc(outlen); if ((outlen = b64_ntop(buf, len, out, outlen)) == -1) { - abort(); free(out); return; } diff --git a/mode-tree.c b/mode-tree.c index 75034675..20ac3226 100644 --- a/mode-tree.c +++ b/mode-tree.c @@ -480,7 +480,7 @@ mode_tree_add(struct mode_tree_data *mtd, struct mode_tree_item *parent, saved = mode_tree_find_item(&mtd->saved, tag); if (saved != NULL) { - if (parent == NULL || (parent != NULL && parent->expanded)) + if (parent == NULL || parent->expanded) mti->tagged = saved->tagged; mti->expanded = saved->expanded; } else if (expanded == -1) diff --git a/options.c b/options.c index 7d79cf30..7e12544d 100644 --- a/options.c +++ b/options.c @@ -365,7 +365,8 @@ options_array_set(struct options_entry *o, u_int idx, const char *value, pr = cmd_parse_from_string(value, NULL); switch (pr->status) { case CMD_PARSE_EMPTY: - *cause = xstrdup("empty command"); + if (cause != NULL) + *cause = xstrdup("empty command"); return (-1); case CMD_PARSE_ERROR: if (cause != NULL) diff --git a/window.c b/window.c index b08a5d35..1d83c247 100644 --- a/window.c +++ b/window.c @@ -1136,7 +1136,7 @@ window_pane_reset_mode(struct window_pane *wp) } else { log_debug("%s: next mode is %s", __func__, next->mode->name); wp->screen = next->screen; - if (next != NULL && next->mode->resize != NULL) + if (next->mode->resize != NULL) next->mode->resize(next, wp->sx, wp->sy); } wp->flags |= (PANE_REDRAW|PANE_CHANGED); -- cgit From 82e47403c6a8d6fff90f77e9262840050b8e6b2e Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 31 May 2019 11:34:09 +0000 Subject: Allow % strings that are all numbers or %s, and fix a double free. Both reported by George Nachman, GitHub issues 1765 and 1766. --- cmd-parse.y | 10 +++++++--- control.c | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd-parse.y b/cmd-parse.y index d5d12d95..0a627268 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -998,11 +998,15 @@ yylex(void) if (ch == '%') { /* - * % is a condition unless it is alone, then it is a - * token. + * % is a condition unless it is all % or all numbers, + * then it is a token. */ yylval.token = yylex_get_word('%'); - if (strcmp(yylval.token, "%") == 0) + for (cp = yylval.token; *cp != '\0'; cp++) { + if (*cp != '%' && !isdigit((u_char)*cp)) + break; + } + if (*cp == '\0') return (TOKEN); if (strcmp(yylval.token, "%if") == 0) { free(yylval.token); diff --git a/control.c b/control.c index b7ac3f62..16fa71bb 100644 --- a/control.c +++ b/control.c @@ -91,7 +91,6 @@ control_callback(struct client *c, int closed, __unused void *data) case CMD_PARSE_ERROR: item = cmdq_get_callback(control_error, pr->error); cmdq_append(c, item); - free(pr->error); break; case CMD_PARSE_SUCCESS: item = cmdq_get_command(pr->cmdlist, NULL, NULL, 0); -- cgit From 2c5f3074bcd3c4d1399a5cf3691430027452266f Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 31 May 2019 21:41:17 +0000 Subject: Fix warnings, from Ben Boeckel. --- cmd-queue.c | 2 +- format.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd-queue.c b/cmd-queue.c index 93dcaa53..1ee43508 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -202,7 +202,7 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current, { struct cmdq_item *item, *first = NULL, *last = NULL; struct cmd *cmd; - struct cmdq_shared *shared; + struct cmdq_shared *shared = NULL; u_int group = 0; TAILQ_FOREACH(cmd, &cmdlist->list, qentry) { diff --git a/format.c b/format.c index 0cf7ee64..a2174e8c 100644 --- a/format.c +++ b/format.c @@ -1502,7 +1502,7 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, char **buf, size_t *len, size_t *off) { struct window_pane *wp = ft->wp; - const char *errptr, *copy, *cp, *marker; + const char *errptr, *copy, *cp, *marker = NULL; char *copy0, *condition, *found, *new; char *value, *left, *right; size_t valuelen; @@ -1550,8 +1550,6 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, limit = 0; if (fm->argc == 2 && fm->argv[1] != NULL) marker = fm->argv[1]; - else - marker = NULL; break; case 'l': modifiers |= FORMAT_LITERAL; -- cgit From 88ee5a1a00b475fd2b93ef00e71f527fe2e9520e Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 31 May 2019 22:50:30 +0100 Subject: Add a crashing config. --- regress/conf/21867280ff7e99631046f9cc669b80d2.conf | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 regress/conf/21867280ff7e99631046f9cc669b80d2.conf diff --git a/regress/conf/21867280ff7e99631046f9cc669b80d2.conf b/regress/conf/21867280ff7e99631046f9cc669b80d2.conf new file mode 100644 index 00000000..43b142b4 --- /dev/null +++ b/regress/conf/21867280ff7e99631046f9cc669b80d2.conf @@ -0,0 +1,8 @@ +%if #{l:1} +set -g status-style fg=cyan,bg='#001040' +%elif #{l:1} +set -g status-style fg=white,bg='#400040' +%else +set -g status-style fg=white,bg='#800000' +%endif +bind ^X last-window -- cgit From 39ea8a2787a29265970d0ef47a879527bc30d1f8 Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 1 Jun 2019 06:20:22 +0000 Subject: Need stdlib.h, from Ben Boeckel. --- cmd-parse.y | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd-parse.y b/cmd-parse.y index 0a627268..402ec806 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -23,6 +23,7 @@ #include #include #include +#include #include #include -- cgit From 3d29b97768530f55aab2d7466124a038bc72e1ce Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 1 Jun 2019 07:24:33 +0100 Subject: Link to file. --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 6e262ef5..3e892d7c 100644 --- a/.github/README.md +++ b/.github/README.md @@ -57,7 +57,7 @@ explains some ideas for tmux not yet developed. Please feel free to ask for clarifications on the mailing list if you're thinking of working on these or need further information. -Please read the CONTRIBUTING file before opening an issue. +Please read [this document](Contributing.md) before opening an issue. ## Documentation -- cgit From feff55b92fe5a8382aa0cfd56f961330fe13741a Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 1 Jun 2019 07:26:39 +0100 Subject: Try this instead. --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 3e892d7c..1e7e9a42 100644 --- a/.github/README.md +++ b/.github/README.md @@ -57,7 +57,7 @@ explains some ideas for tmux not yet developed. Please feel free to ask for clarifications on the mailing list if you're thinking of working on these or need further information. -Please read [this document](Contributing.md) before opening an issue. +Please read [this document](./Contributing.md) before opening an issue. ## Documentation -- cgit From c2d79add3179c5062e642b604809a3d87b6ff360 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 1 Jun 2019 07:28:31 +0100 Subject: Should be caps. --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 1e7e9a42..9a95772c 100644 --- a/.github/README.md +++ b/.github/README.md @@ -57,7 +57,7 @@ explains some ideas for tmux not yet developed. Please feel free to ask for clarifications on the mailing list if you're thinking of working on these or need further information. -Please read [this document](./Contributing.md) before opening an issue. +Please read [this document](CONTRIBUTING.md) before opening an issue. ## Documentation -- cgit From b28b8312f2a40d3fe7321375b91329eca4efb698 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 1 Jun 2019 08:05:55 +0100 Subject: Mention CHANGES. --- .github/CONTRIBUTING.md | 9 ++++++++- .github/ISSUE_TEMPLATE.md | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 49e2b90b..3a589484 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,13 +2,20 @@ Before opening an issue, please ensure that: +- Your problem is a specific problem or question or suggestion, not a general + complaint. + - `$TERM` inside tmux is screen, screen-256color, tmux or tmux-256color. Check by running `echo $TERM` inside tmux. - You can reproduce the problem with the latest tmux release, or a build from Git master. -- Your question or issue is not covered in the manual (run man tmux). +- Your question or issue is not covered [in the + manual](https://man.openbsd.org/tmux.1) (run `man tmux`). + +- Your problem is not mentioned in the [CHANGES + file](https://raw.githubusercontent.com/tmux/tmux/master/CHANGES) file. - Nobody else has opened the same issue recently. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index ee457237..8bf1e66a 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -3,6 +3,9 @@ Please read https://github.com/tmux/tmux/blob/master/.github/CONTRIBUTING.md before opening an issue. +If you have upgraded, make sure your issue is not covered in the CHANGES file +for your version: https://raw.githubusercontent.com/tmux/tmux/master/CHANGES + Describe the problem and the steps to reproduce. Add a minimal tmux config if necessary. Screenshots can be helpful, but no more than one or two. -- cgit From ec690208a3b416ce2b3713e3e882ba414afd8c0f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 1 Jun 2019 08:07:22 +0100 Subject: Move link. --- .github/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/README.md b/.github/README.md index 9a95772c..cfff69da 100644 --- a/.github/README.md +++ b/.github/README.md @@ -50,15 +50,14 @@ welcome. Please send by email to: tmux-users@googlegroups.com -Or open a GitHub issue or pull request. +Or open a GitHub issue or pull request. **Please read [this +document](CONTRIBUTING.md) before opening an issue.** There is [a TODO list](https://github.com/tmux/tmux/wiki/Contributing) which explains some ideas for tmux not yet developed. Please feel free to ask for clarifications on the mailing list if you're thinking of working on these or need further information. -Please read [this document](CONTRIBUTING.md) before opening an issue. - ## Documentation For documentation on using tmux, see the tmux.1 manpage. View it from the -- cgit From 2c6c3a1d27d3665a47d037965955d2bad1f81bcc Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 1 Jun 2019 16:21:37 +0000 Subject: If only one of -x or -y is given, use the calculated size for the other. Pointed out by Ben Boeckel. --- cmd-new-session.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd-new-session.c b/cmd-new-session.c index 2fd13420..559c268c 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -242,8 +242,13 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) /* Create the new session. */ oo = options_create(global_s_options); - if (args_has(args, 'x') || args_has(args, 'y')) + if (args_has(args, 'x') || args_has(args, 'y')) { + if (!args_has(args, 'x')) + dsx = sx; + if (!args_has(args, 'y')) + dsy = sy; options_set_string(oo, "default-size", 0, "%ux%u", dsx, dsy); + } env = environ_create(); if (c != NULL && !args_has(args, 'E')) environ_update(global_s_options, c->environ, env); -- cgit From 900238a30657a477f3c62ba344fcc73fc0948ac7 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 2 Jun 2019 07:10:15 +0000 Subject: yacc(1) copies its union so it is not a good place to store TAILQ_HEADs. Allocate them instead. Found from a problem reported by sthen@. --- cmd-parse.y | 263 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 140 insertions(+), 123 deletions(-) diff --git a/cmd-parse.y b/cmd-parse.y index 402ec806..e27cdcd8 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -65,7 +65,7 @@ struct cmd_parse_state { u_int escapes; char *error; - struct cmd_parse_commands commands; + struct cmd_parse_commands *commands; struct cmd_parse_scope *scope; TAILQ_HEAD(, cmd_parse_scope) stack; @@ -74,6 +74,7 @@ static struct cmd_parse_state parse_state; static char *cmd_parse_get_error(const char *, u_int, const char *); static void cmd_parse_free_command(struct cmd_parse_command *); +static struct cmd_parse_commands *cmd_parse_new_commands(void); static void cmd_parse_free_commands(struct cmd_parse_commands *); %} @@ -88,9 +89,9 @@ static void cmd_parse_free_commands(struct cmd_parse_commands *); int flag; struct { int flag; - struct cmd_parse_commands commands; + struct cmd_parse_commands *commands; } elif; - struct cmd_parse_commands commands; + struct cmd_parse_commands *commands; struct cmd_parse_command *command; } @@ -115,45 +116,46 @@ lines : /* empty */ { struct cmd_parse_state *ps = &parse_state; - TAILQ_CONCAT(&ps->commands, &$1, entry); + ps->commands = $1; } statements : statement '\n' { - TAILQ_INIT(&$$); - TAILQ_CONCAT(&$$, &$1, entry); + $$ = $1; } | statements statement '\n' { - TAILQ_INIT(&$$); - TAILQ_CONCAT(&$$, &$1, entry); - TAILQ_CONCAT(&$$, &$2, entry); + $$ = $1; + TAILQ_CONCAT($$, $2, entry); + free($2); } - statement : condition { struct cmd_parse_state *ps = &parse_state; - TAILQ_INIT(&$$); if (ps->scope == NULL || ps->scope->flag) - TAILQ_CONCAT(&$$, &$1, entry); - else - cmd_parse_free_commands(&$1); + $$ = $1; + else { + $$ = cmd_parse_new_commands(); + cmd_parse_free_commands($1); + } } | assignment { - TAILQ_INIT(&$$); + $$ = xmalloc (sizeof *$$); + TAILQ_INIT($$); } | commands { struct cmd_parse_state *ps = &parse_state; - TAILQ_INIT(&$$); if (ps->scope == NULL || ps->scope->flag) - TAILQ_CONCAT(&$$, &$1, entry); - else - cmd_parse_free_commands(&$1); + $$ = $1; + else { + $$ = cmd_parse_new_commands(); + cmd_parse_free_commands($1); + } } expanded : FORMAT @@ -243,117 +245,119 @@ if_close : ENDIF condition : if_open '\n' statements if_close { - TAILQ_INIT(&$$); if ($1) - TAILQ_CONCAT(&$$, &$3, entry); - else - cmd_parse_free_commands(&$3); + $$ = $3; + else { + $$ = cmd_parse_new_commands(); + cmd_parse_free_commands($3); + } } | if_open '\n' statements if_else '\n' statements if_close { - TAILQ_INIT(&$$); if ($1) { - TAILQ_CONCAT(&$$, &$3, entry); - cmd_parse_free_commands(&$6); + $$ = $3; + cmd_parse_free_commands($6); } else { - TAILQ_CONCAT(&$$, &$6, entry); - cmd_parse_free_commands(&$3); + $$ = $6; + cmd_parse_free_commands($3); } } | if_open '\n' statements elif if_close { - TAILQ_INIT(&$$); if ($1) { - TAILQ_CONCAT(&$$, &$3, entry); - cmd_parse_free_commands(&$4.commands); + $$ = $3; + cmd_parse_free_commands($4.commands); } else if ($4.flag) { - TAILQ_CONCAT(&$$, &$4.commands, entry); - cmd_parse_free_commands(&$3); + $$ = $4.commands; + cmd_parse_free_commands($3); } else { - cmd_parse_free_commands(&$3); - cmd_parse_free_commands(&$4.commands); + $$ = cmd_parse_new_commands(); + cmd_parse_free_commands($3); + cmd_parse_free_commands($4.commands); } } | if_open '\n' statements elif if_else '\n' statements if_close { - TAILQ_INIT(&$$); if ($1) { - TAILQ_CONCAT(&$$, &$3, entry); - cmd_parse_free_commands(&$4.commands); - cmd_parse_free_commands(&$7); + $$ = $3; + cmd_parse_free_commands($4.commands); + cmd_parse_free_commands($7); } else if ($4.flag) { - TAILQ_CONCAT(&$$, &$4.commands, entry); - cmd_parse_free_commands(&$3); - cmd_parse_free_commands(&$7); + $$ = $4.commands; + cmd_parse_free_commands($3); + cmd_parse_free_commands($7); } else { - TAILQ_CONCAT(&$$, &$7, entry); - cmd_parse_free_commands(&$3); - cmd_parse_free_commands(&$4.commands); + $$ = $7; + cmd_parse_free_commands($3); + cmd_parse_free_commands($4.commands); } } elif : if_elif '\n' statements { - TAILQ_INIT(&$$.commands); - if ($1) - TAILQ_CONCAT(&$$.commands, &$3, entry); - else - cmd_parse_free_commands(&$3); - $$.flag = $1; + if ($1) { + $$.flag = 1; + $$.commands = $3; + } else { + $$.flag = 0; + $$.commands = cmd_parse_new_commands(); + cmd_parse_free_commands($3); + } } | if_elif '\n' statements elif { - TAILQ_INIT(&$$.commands); if ($1) { $$.flag = 1; - TAILQ_CONCAT(&$$.commands, &$3, entry); - cmd_parse_free_commands(&$4.commands); + $$.commands = $3; + cmd_parse_free_commands($4.commands); + } else if ($4.flag) { + $$.flag = 1; + $$.commands = $4.commands; + cmd_parse_free_commands($3); } else { - $$.flag = $4.flag; - TAILQ_CONCAT(&$$.commands, &$4.commands, entry); - cmd_parse_free_commands(&$3); + $$.flag = 0; + $$.commands = cmd_parse_new_commands(); + cmd_parse_free_commands($3); + cmd_parse_free_commands($4.commands); } } - commands : command { struct cmd_parse_state *ps = &parse_state; - TAILQ_INIT(&$$); + $$ = cmd_parse_new_commands(); if (ps->scope == NULL || ps->scope->flag) - TAILQ_INSERT_TAIL(&$$, $1, entry); + TAILQ_INSERT_TAIL($$, $1, entry); else cmd_parse_free_command($1); } | commands ';' { - TAILQ_INIT(&$$); - TAILQ_CONCAT(&$$, &$1, entry); + $$ = $1; } | commands ';' condition1 { - TAILQ_INIT(&$$); - TAILQ_CONCAT(&$$, &$1, entry); - TAILQ_CONCAT(&$$, &$3, entry); + $$ = $1; + TAILQ_CONCAT($$, $3, entry); + free($3); } | commands ';' command { struct cmd_parse_state *ps = &parse_state; - TAILQ_INIT(&$$); if (ps->scope == NULL || ps->scope->flag) { - TAILQ_CONCAT(&$$, &$1, entry); - TAILQ_INSERT_TAIL(&$$, $3, entry); + $$ = $1; + TAILQ_INSERT_TAIL($$, $3, entry); } else { - cmd_parse_free_commands(&$1); + $$ = cmd_parse_new_commands(); + cmd_parse_free_commands($1); cmd_parse_free_command($3); } } | condition1 { - TAILQ_INIT(&$$); - TAILQ_CONCAT(&$$, &$1, entry); + $$ = $1; } command : assignment TOKEN @@ -379,76 +383,80 @@ command : assignment TOKEN condition1 : if_open commands if_close { - TAILQ_INIT(&$$); if ($1) - TAILQ_CONCAT(&$$, &$2, entry); - else - cmd_parse_free_commands(&$2); + $$ = $2; + else { + $$ = cmd_parse_new_commands(); + cmd_parse_free_commands($2); + } } | if_open commands if_else commands if_close { - TAILQ_INIT(&$$); if ($1) { - TAILQ_CONCAT(&$$, &$2, entry); - cmd_parse_free_commands(&$4); + $$ = $2; + cmd_parse_free_commands($4); } else { - TAILQ_CONCAT(&$$, &$4, entry); - cmd_parse_free_commands(&$2); + $$ = $4; + cmd_parse_free_commands($2); } } | if_open commands elif1 if_close { - TAILQ_INIT(&$$); if ($1) { - TAILQ_CONCAT(&$$, &$2, entry); - cmd_parse_free_commands(&$3.commands); + $$ = $2; + cmd_parse_free_commands($3.commands); } else if ($3.flag) { - TAILQ_CONCAT(&$$, &$3.commands, entry); - cmd_parse_free_commands(&$2); + $$ = $3.commands; + cmd_parse_free_commands($2); } else { - cmd_parse_free_commands(&$2); - cmd_parse_free_commands(&$3.commands); + $$ = cmd_parse_new_commands(); + cmd_parse_free_commands($2); + cmd_parse_free_commands($3.commands); } } | if_open commands elif1 if_else commands if_close { - TAILQ_INIT(&$$); if ($1) { - TAILQ_CONCAT(&$$, &$2, entry); - cmd_parse_free_commands(&$3.commands); - cmd_parse_free_commands(&$5); + $$ = $2; + cmd_parse_free_commands($3.commands); + cmd_parse_free_commands($5); } else if ($3.flag) { - TAILQ_CONCAT(&$$, &$3.commands, entry); - cmd_parse_free_commands(&$2); - cmd_parse_free_commands(&$5); + $$ = $3.commands; + cmd_parse_free_commands($2); + cmd_parse_free_commands($5); } else { - TAILQ_CONCAT(&$$, &$5, entry); - cmd_parse_free_commands(&$2); - cmd_parse_free_commands(&$3.commands); + $$ = $5; + cmd_parse_free_commands($2); + cmd_parse_free_commands($3.commands); } - } elif1 : if_elif commands { - TAILQ_INIT(&$$.commands); - if ($1) - TAILQ_CONCAT(&$$.commands, &$2, entry); - else - cmd_parse_free_commands(&$2); - $$.flag = $1; + if ($1) { + $$.flag = 1; + $$.commands = $2; + } else { + $$.flag = 0; + $$.commands = cmd_parse_new_commands(); + cmd_parse_free_commands($2); + } } | if_elif commands elif1 { - TAILQ_INIT(&$$.commands); if ($1) { $$.flag = 1; - TAILQ_CONCAT(&$$.commands, &$2, entry); - cmd_parse_free_commands(&$3.commands); + $$.commands = $2; + cmd_parse_free_commands($3.commands); + } else if ($3.flag) { + $$.flag = 1; + $$.commands = $3.commands; + cmd_parse_free_commands($2); } else { - $$.flag = $3.flag; - TAILQ_CONCAT(&$$.commands, &$3.commands, entry); - cmd_parse_free_commands(&$2); + $$.flag = 0; + $$.commands = cmd_parse_new_commands(); + cmd_parse_free_commands($2); + cmd_parse_free_commands($3.commands); } } @@ -497,6 +505,16 @@ cmd_parse_free_command(struct cmd_parse_command *cmd) free(cmd); } +static struct cmd_parse_commands * +cmd_parse_new_commands(void) +{ + struct cmd_parse_commands *cmds; + + cmds = xmalloc(sizeof *cmds); + TAILQ_INIT (cmds); + return (cmds); +} + static void cmd_parse_free_commands(struct cmd_parse_commands *cmds) { @@ -506,17 +524,17 @@ cmd_parse_free_commands(struct cmd_parse_commands *cmds) TAILQ_REMOVE(cmds, cmd, entry); cmd_parse_free_command(cmd); } + free(cmds); } static struct cmd_parse_commands * cmd_parse_run_parser(char **cause) { - struct cmd_parse_state *ps = &parse_state; - struct cmd_parse_commands *cmds; - struct cmd_parse_scope *scope, *scope1; - int retval; + struct cmd_parse_state *ps = &parse_state; + struct cmd_parse_scope *scope, *scope1; + int retval; - TAILQ_INIT(&ps->commands); + ps->commands = NULL; TAILQ_INIT(&ps->stack); retval = yyparse(); @@ -529,10 +547,9 @@ cmd_parse_run_parser(char **cause) return (NULL); } - cmds = xmalloc(sizeof *cmds); - TAILQ_INIT(cmds); - TAILQ_CONCAT(cmds, &ps->commands, entry); - return (cmds); + if (ps->commands == NULL) + return (cmd_parse_new_commands()); + return (ps->commands); } static struct cmd_parse_commands * @@ -574,7 +591,7 @@ cmd_parse_build_commands(struct cmd_parse_commands *cmds, /* Check for an empty list. */ if (TAILQ_EMPTY(cmds)) { - free(cmds); + cmd_parse_free_commands(cmds); pr.status = CMD_PARSE_EMPTY; return (&pr); } @@ -668,7 +685,6 @@ cmd_parse_build_commands(struct cmd_parse_commands *cmds, out: cmd_parse_free_commands(cmds); - free(cmds); return (&pr); } @@ -747,8 +763,7 @@ cmd_parse_from_arguments(int argc, char **argv, struct cmd_parse_input *pi) } cmd_log_argv(argc, argv, "%s", __func__); - cmds = xmalloc(sizeof *cmds); - TAILQ_INIT(cmds); + cmds = cmd_parse_new_commands(); copy = cmd_copy_argv(argc, argv); last = 0; @@ -801,6 +816,8 @@ cmd_parse_from_arguments(int argc, char **argv, struct cmd_parse_input *pi) TAILQ_INSERT_TAIL(cmds, cmd, entry); } } + + cmd_free_argv(argc, copy); return (cmd_parse_build_commands(cmds, pi)); } -- cgit From 4ca1de1b8bc10dca47d2cf7399df41845c902c9e Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 3 Jun 2019 18:28:37 +0000 Subject: Add new-session -X and attach-session -x to send SIGHUP to parent when detaching (like detach-client -P). From Colin Watson in GitHub issue 1773. --- cmd-attach-session.c | 27 ++++++++++++++++++--------- cmd-new-session.c | 7 ++++--- tmux.1 | 14 ++++++++++++-- tmux.h | 2 +- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/cmd-attach-session.c b/cmd-attach-session.c index bcd6d895..6de734e5 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -37,8 +37,8 @@ const struct cmd_entry cmd_attach_session_entry = { .name = "attach-session", .alias = "attach", - .args = { "c:dErt:", 0, 0 }, - .usage = "[-dEr] [-c working-directory] " CMD_TARGET_SESSION_USAGE, + .args = { "c:dErt:x", 0, 0 }, + .usage = "[-dErx] [-c working-directory] " CMD_TARGET_SESSION_USAGE, /* -t is special */ @@ -48,7 +48,7 @@ const struct cmd_entry cmd_attach_session_entry = { enum cmd_retval cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag, - int rflag, const char *cflag, int Eflag) + int xflag, int rflag, const char *cflag, int Eflag) { struct cmd_find_state *current = &item->shared->current; enum cmd_find_type type; @@ -58,6 +58,7 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag, struct winlink *wl; struct window_pane *wp; char *cause; + enum msgtype msgtype; if (RB_EMPTY(&sessions)) { cmdq_error(item, "no sessions"); @@ -102,11 +103,15 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag, c->last_session = c->session; if (c->session != NULL) { - if (dflag) { + if (dflag || xflag) { + if (xflag) + msgtype = MSG_DETACHKILL; + else + msgtype = MSG_DETACH; TAILQ_FOREACH(c_loop, &clients, entry) { if (c_loop->session != s || c == c_loop) continue; - server_client_detach(c_loop, MSG_DETACH); + server_client_detach(c_loop, msgtype); } } if (!Eflag) @@ -131,11 +136,15 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag, if (rflag) c->flags |= CLIENT_READONLY; - if (dflag) { + if (dflag || xflag) { + if (xflag) + msgtype = MSG_DETACHKILL; + else + msgtype = MSG_DETACH; TAILQ_FOREACH(c_loop, &clients, entry) { if (c_loop->session != s || c == c_loop) continue; - server_client_detach(c_loop, MSG_DETACH); + server_client_detach(c_loop, msgtype); } } if (!Eflag) @@ -169,6 +178,6 @@ cmd_attach_session_exec(struct cmd *self, struct cmdq_item *item) struct args *args = self->args; return (cmd_attach_session(item, args_get(args, 't'), - args_has(args, 'd'), args_has(args, 'r'), args_get(args, 'c'), - args_has(args, 'E'))); + args_has(args, 'd'), args_has(args, 'x'), args_has(args, 'r'), + args_get(args, 'c'), args_has(args, 'E'))); } diff --git a/cmd-new-session.c b/cmd-new-session.c index 559c268c..e0540815 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -39,8 +39,8 @@ const struct cmd_entry cmd_new_session_entry = { .name = "new-session", .alias = "new", - .args = { "Ac:dDEF:n:Ps:t:x:y:", 0, -1 }, - .usage = "[-AdDEP] [-c start-directory] [-F format] [-n window-name] " + .args = { "Ac:dDEF:n:Ps:t:x:Xy:", 0, -1 }, + .usage = "[-AdDEPX] [-c start-directory] [-F format] [-n window-name] " "[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] " "[-y height] [command]", @@ -105,7 +105,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) if (args_has(args, 'A')) { retval = cmd_attach_session(item, newname, args_has(args, 'D'), - 0, NULL, args_has(args, 'E')); + args_has(args, 'X'), 0, NULL, + args_has(args, 'E')); free(newname); return (retval); } diff --git a/tmux.1 b/tmux.1 index d9b37c0e..6917e8b0 100644 --- a/tmux.1 +++ b/tmux.1 @@ -918,7 +918,7 @@ section. The following commands are available to manage clients and sessions: .Bl -tag -width Ds .It Xo Ic attach-session -.Op Fl dEr +.Op Fl dErx .Op Fl c Ar working-directory .Op Fl t Ar target-session .Xc @@ -931,6 +931,10 @@ If used from inside, switch the current client. If .Fl d is specified, any other clients attached to the session are detached. +If +.Fl x +is given, send SIGHUP to the parent process of the client as well as +detaching the client, typically causing it to exit. .Fl r signifies the client is read-only (only keys bound to the .Ic detach-client @@ -1048,7 +1052,7 @@ command. Lock all clients attached to .Ar target-session . .It Xo Ic new-session -.Op Fl AdDEP +.Op Fl AdDEPX .Op Fl c Ar start-directory .Op Fl F Ar format .Op Fl n Ar window-name @@ -1105,6 +1109,12 @@ already exists; in this case, behaves like .Fl d to +.Ic attach-session , +and +.Fl X +behaves like +.Fl x +to .Ic attach-session . .Pp If diff --git a/tmux.h b/tmux.h index 8eb1e65a..3849790c 100644 --- a/tmux.h +++ b/tmux.h @@ -2009,7 +2009,7 @@ extern const struct cmd_entry *cmd_table[]; /* cmd-attach-session.c */ enum cmd_retval cmd_attach_session(struct cmdq_item *, const char *, int, int, - const char *, int); + int, const char *, int); /* cmd-parse.c */ void cmd_parse_empty(struct cmd_parse_input *); -- cgit From 09e90c1645a8ecd1e467b13a743bb46d48febd37 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 5 Jun 2019 19:00:36 +0000 Subject: Need to increment the argument to skip the prefix earlier, fixes repeated incremental search in copy mode, reported by Kaushal Modi in GitHub issue 1780. --- window-copy.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/window-copy.c b/window-copy.c index 36ad6a83..d81073bf 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1668,9 +1668,11 @@ window_copy_cmd_search_backward_incremental(struct window_copy_cmd_state *cs) struct window_mode_entry *wme = cs->wme; struct window_copy_mode_data *data = wme->data; const char *argument = cs->args->argv[1]; - enum window_copy_cmd_action action = WINDOW_COPY_CMD_NOTHING; const char *ss = data->searchstr; + char prefix; + enum window_copy_cmd_action action = WINDOW_COPY_CMD_NOTHING; + prefix = *argument++; if (data->searchx == -1 || data->searchy == -1) { data->searchx = data->cx; data->searchy = data->cy; @@ -1681,13 +1683,11 @@ window_copy_cmd_search_backward_incremental(struct window_copy_cmd_state *cs) data->oy = data->searcho; action = WINDOW_COPY_CMD_REDRAW; } - if (*argument == '\0') { window_copy_clear_marks(wme); return (WINDOW_COPY_CMD_REDRAW); } - - switch (*argument++) { + switch (prefix) { case '=': case '-': data->searchtype = WINDOW_COPY_SEARCHUP; @@ -1717,9 +1717,11 @@ window_copy_cmd_search_forward_incremental(struct window_copy_cmd_state *cs) struct window_mode_entry *wme = cs->wme; struct window_copy_mode_data *data = wme->data; const char *argument = cs->args->argv[1]; - enum window_copy_cmd_action action = WINDOW_COPY_CMD_NOTHING; const char *ss = data->searchstr; + char prefix; + enum window_copy_cmd_action action = WINDOW_COPY_CMD_NOTHING; + prefix = *argument++; if (data->searchx == -1 || data->searchy == -1) { data->searchx = data->cx; data->searchy = data->cy; @@ -1730,13 +1732,11 @@ window_copy_cmd_search_forward_incremental(struct window_copy_cmd_state *cs) data->oy = data->searcho; action = WINDOW_COPY_CMD_REDRAW; } - if (*argument == '\0') { window_copy_clear_marks(wme); return (WINDOW_COPY_CMD_REDRAW); } - - switch (*argument++) { + switch (prefix) { case '=': case '+': data->searchtype = WINDOW_COPY_SEARCHDOWN; -- cgit From 8f40796f05f2db0ff8b2c9231054b62b511a7ba0 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 5 Jun 2019 20:00:53 +0000 Subject: Add a -v flag to source-file to show the commands and line numbers. --- cfg.c | 1 + cmd-parse.y | 17 +++++++++++++++++ cmd-source-file.c | 6 ++++-- tmux.1 | 4 +++- tmux.h | 1 + 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/cfg.c b/cfg.c index d6435980..c79150de 100644 --- a/cfg.c +++ b/cfg.c @@ -127,6 +127,7 @@ load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags, pi.flags = flags; pi.file = path; pi.line = 1; + pi.item = item; pr = cmd_parse_from_file(f, &pi); fclose(f); diff --git a/cmd-parse.y b/cmd-parse.y index e27cdcd8..a7c12f62 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -76,6 +76,8 @@ static char *cmd_parse_get_error(const char *, u_int, const char *); static void cmd_parse_free_command(struct cmd_parse_command *); static struct cmd_parse_commands *cmd_parse_new_commands(void); static void cmd_parse_free_commands(struct cmd_parse_commands *); +static void cmd_parse_print_commands(struct cmd_parse_input *, u_int, + struct cmd_list *); %} @@ -497,6 +499,19 @@ cmd_parse_get_error(const char *file, u_int line, const char *error) return (s); } +static void +cmd_parse_print_commands(struct cmd_parse_input *pi, u_int line, + struct cmd_list *cmdlist) +{ + char *s; + + if (pi->item != NULL && (pi->flags & CMD_PARSE_VERBOSE)) { + s = cmd_list_print(cmdlist, 0); + cmdq_print(pi->item, "%u: %s", line, s); + free(s); + } +} + static void cmd_parse_free_command(struct cmd_parse_command *cmd) { @@ -653,6 +668,7 @@ cmd_parse_build_commands(struct cmd_parse_commands *cmds, if (cmdlist == NULL || cmd->line != line) { if (cmdlist != NULL) { + cmd_parse_print_commands(pi, line, cmdlist); cmd_list_move(result, cmdlist); cmd_list_free(cmdlist); } @@ -672,6 +688,7 @@ cmd_parse_build_commands(struct cmd_parse_commands *cmds, cmd_list_append(cmdlist, add); } if (cmdlist != NULL) { + cmd_parse_print_commands(pi, line, cmdlist); cmd_list_move(result, cmdlist); cmd_list_free(cmdlist); } diff --git a/cmd-source-file.c b/cmd-source-file.c index d88f74cf..b867db67 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -38,8 +38,8 @@ const struct cmd_entry cmd_source_file_entry = { .name = "source-file", .alias = "source", - .args = { "nq", 1, -1 }, - .usage = "[-nq] path ...", + .args = { "nqv", 1, -1 }, + .usage = "[-nqv] path ...", .flags = 0, .exec = cmd_source_file_exec @@ -63,6 +63,8 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item) flags |= CMD_PARSE_QUIET; if (args_has(args, 'n')) flags |= CMD_PARSE_PARSEONLY; + if (args_has(args, 'v')) + flags |= CMD_PARSE_VERBOSE; utf8_stravis(&cwd, server_client_get_cwd(c, NULL), VIS_GLOB); retval = CMD_RETURN_NORMAL; diff --git a/tmux.1 b/tmux.1 index 6917e8b0..9f97422c 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1251,7 +1251,7 @@ and .Fl T show debugging information about jobs and terminals. .It Xo Ic source-file -.Op Fl nq +.Op Fl nqv .Ar path .Ar ... .Xc @@ -1269,6 +1269,8 @@ does not exist. With .Fl n , the file is parsed but no commands are executed. +.Fl v +shows the parsed commands and line numbers if possible. .It Ic start-server .D1 (alias: Ic start ) Start the diff --git a/tmux.h b/tmux.h index 3849790c..f8ceb95d 100644 --- a/tmux.h +++ b/tmux.h @@ -1324,6 +1324,7 @@ struct cmd_parse_input { #define CMD_PARSE_QUIET 0x1 #define CMD_PARSE_PARSEONLY 0x2 #define CMD_PARSE_NOALIAS 0x4 +#define CMD_PARSE_VERBOSE 0x8 const char *file; u_int line; -- cgit From e37f34facc05c3ba146d4158cc7af23f6886fecd Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 7 Jun 2019 20:09:17 +0000 Subject: Do not load the config file if the server is exiting because it failed to start, otherwise commands like lsk which start the server again can end up looping infinitely. Also make the first client exit correctly. Problem reported by Wael M Nasreddine. --- server-client.c | 6 ++++-- server.c | 10 ++++++---- tmux.h | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/server-client.c b/server-client.c index 52842e38..fa21fa79 100644 --- a/server-client.c +++ b/server-client.c @@ -1511,7 +1511,9 @@ server_client_click_timer(__unused int fd, __unused short events, void *data) static void server_client_check_exit(struct client *c) { - if (!(c->flags & CLIENT_EXIT)) + if (~c->flags & CLIENT_EXIT) + return; + if (c->flags & CLIENT_EXITED) return; if (EVBUFFER_LENGTH(c->stdin_data) != 0) @@ -1524,7 +1526,7 @@ server_client_check_exit(struct client *c) if (c->flags & CLIENT_ATTACHED) notify_client("client-detached", c); proc_send(c->peer, MSG_EXIT, -1, &c->retval, sizeof c->retval); - c->flags &= ~CLIENT_EXIT; + c->flags |= CLIENT_EXITED; } /* Redraw timer callback. */ diff --git a/server.c b/server.c index 18818c38..fc3730ad 100644 --- a/server.c +++ b/server.c @@ -44,7 +44,7 @@ struct clients clients; struct tmuxproc *server_proc; -static int server_fd; +static int server_fd = -1; static int server_exit; static struct event server_ev_accept; @@ -208,11 +208,10 @@ server_start(struct tmuxproc *client, struct event_base *base, int lockfd, cmdq_append(c, cmdq_get_error(cause)); free(cause); c->flags |= CLIENT_EXIT; - } + } else + start_cfg(); - start_cfg(); server_add_accept(0); - proc_loop(server_proc, server_loop); job_kill_all(); @@ -364,6 +363,9 @@ server_add_accept(int timeout) { struct timeval tv = { timeout, 0 }; + if (server_fd == -1) + return; + if (event_initialized(&server_ev_accept)) event_del(&server_ev_accept); diff --git a/tmux.h b/tmux.h index f8ceb95d..76bf8303 100644 --- a/tmux.h +++ b/tmux.h @@ -1490,7 +1490,7 @@ struct client { #define CLIENT_REPEAT 0x20 #define CLIENT_SUSPENDED 0x40 #define CLIENT_ATTACHED 0x80 -/* 0x100 unused */ +#define CLIENT_EXITED 0x100 #define CLIENT_DEAD 0x200 #define CLIENT_REDRAWBORDERS 0x400 #define CLIENT_READONLY 0x800 -- cgit From 43796bf131c4d7d3a44185c10e5d75860869af0d Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 8 Jun 2019 21:48:29 +0000 Subject: Do not try to parse command when unsetting, GitHub issue 1788. --- options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options.c b/options.c index 7e12544d..619c27ed 100644 --- a/options.c +++ b/options.c @@ -361,7 +361,7 @@ options_array_set(struct options_entry *o, u_int idx, const char *value, return (-1); } - if (OPTIONS_IS_COMMAND(o)) { + if (OPTIONS_IS_COMMAND(o) && value != NULL) { pr = cmd_parse_from_string(value, NULL); switch (pr->status) { case CMD_PARSE_EMPTY: -- cgit From 915097d312319a463fa4333c9bdf728b8dd6d39d Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 9 Jun 2019 06:50:24 +0000 Subject: Exiting alternate screen mode should restore cursor position and attributes even if already outside alternate screen mode. GitHub issue 1789. --- window.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/window.c b/window.c index 1d83c247..781ff30c 100644 --- a/window.c +++ b/window.c @@ -804,6 +804,8 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit) wp->pipe_event = NULL; wp->saved_grid = NULL; + wp->saved_cx = UINT_MAX; + wp->saved_cy = UINT_MAX; style_set(&wp->style, &grid_default_cell); @@ -962,10 +964,25 @@ window_pane_alternate_off(struct window_pane *wp, struct grid_cell *gc, struct screen *s = &wp->base; u_int sx, sy; - if (wp->saved_grid == NULL) - return; if (!options_get_number(wp->window->options, "alternate-screen")) return; + + /* + * Restore the cursor position and cell. This happens even if not + * currently in the alternate screen. + */ + if (cursor && wp->saved_cx != UINT_MAX && wp->saved_cy != UINT_MAX) { + s->cx = wp->saved_cx; + if (s->cx > screen_size_x(s) - 1) + s->cx = screen_size_x(s) - 1; + s->cy = wp->saved_cy; + if (s->cy > screen_size_y(s) - 1) + s->cy = screen_size_y(s) - 1; + memcpy(gc, &wp->saved_cell, sizeof *gc); + } + + if (wp->saved_grid == NULL) + return; sx = screen_size_x(s); sy = screen_size_y(s); @@ -976,17 +993,8 @@ window_pane_alternate_off(struct window_pane *wp, struct grid_cell *gc, if (sy > wp->saved_grid->sy) screen_resize(s, sx, wp->saved_grid->sy, 1); - /* Restore the grid, cursor position and cell. */ + /* Restore the saved grid. */ grid_duplicate_lines(s->grid, screen_hsize(s), wp->saved_grid, 0, sy); - if (cursor) - s->cx = wp->saved_cx; - if (s->cx > screen_size_x(s) - 1) - s->cx = screen_size_x(s) - 1; - if (cursor) - s->cy = wp->saved_cy; - if (s->cy > screen_size_y(s) - 1) - s->cy = screen_size_y(s) - 1; - memcpy(gc, &wp->saved_cell, sizeof *gc); /* * Turn history back on (so resize can use it) and then resize back to -- cgit From 1a9f9c09b4bcc9f99f10190ab91f1aea5206809b Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 11 Jun 2019 13:09:00 +0000 Subject: Do not resize panes unless they are in an attached, active window. From Morten M Neergaard in GitHub issue 1782. --- server-client.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server-client.c b/server-client.c index fa21fa79..dc57e523 100644 --- a/server-client.c +++ b/server-client.c @@ -1241,6 +1241,8 @@ server_client_loop(void) struct client *c; struct window *w; struct window_pane *wp; + struct winlink *wl; + struct session *s; int focus; TAILQ_FOREACH(c, &clients, entry) { @@ -1257,8 +1259,13 @@ server_client_loop(void) */ focus = options_get_number(global_options, "focus-events"); RB_FOREACH(w, windows, &windows) { + TAILQ_FOREACH(wl, &w->winlinks, wentry) { + s = wl->session; + if (s->attached != 0 && s->curw == wl) + break; + } TAILQ_FOREACH(wp, &w->panes, entry) { - if (wp->fd != -1) { + if (wl != NULL && wp->fd != -1) { if (focus) server_client_check_focus(wp); server_client_check_resize(wp); -- cgit From e8814a7e9308dfd4617ce01bc0aa3dba15f177c0 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 11 Jun 2019 14:23:47 +0100 Subject: Add to CHANGES. --- CHANGES | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index edd4751b..200e68c8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ CHANGES FROM 3.0 to X.X -XXX +* Add new-session -X and attach-session -x to send SIGHUP to parent when + detaching (like detach-client -P). + +* Support for octal escapes in strings (such as \007). CHANGES FROM 2.9 to 3.0 -- cgit From 8e971f187ab97ff3f22d8e2f7f5050702c99e627 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 11 Jun 2019 14:27:40 +0100 Subject: Update README.md --- .github/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/README.md b/.github/README.md index cfff69da..ce12f6aa 100644 --- a/.github/README.md +++ b/.github/README.md @@ -53,10 +53,9 @@ tmux-users@googlegroups.com Or open a GitHub issue or pull request. **Please read [this document](CONTRIBUTING.md) before opening an issue.** -There is [a TODO list](https://github.com/tmux/tmux/wiki/Contributing) which -explains some ideas for tmux not yet developed. Please feel free to ask for -clarifications on the mailing list if you're thinking of working on these or -need further information. +There is [a list of suggestions for contributions](https://github.com/tmux/tmux/wiki/Contributing). +Please feel free to ask on the mailing list if you're thinking of working on something or need +further information. ## Documentation -- cgit From 9d42bd328c094c679415c623f7a87c200b64984e Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 12 Jun 2019 08:08:33 +0000 Subject: Do not always resize the window back to its original size after applying a layout, let the normal window resize process do it. This means windows are not resized at all if window-size is manual, and are not resized multiple times if later attached to a different size terminal. --- layout-custom.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/layout-custom.c b/layout-custom.c index 9886afe1..4d9e818b 100644 --- a/layout-custom.c +++ b/layout-custom.c @@ -168,10 +168,7 @@ layout_parse(struct window *w, const char *layout) /* Update pane offsets and sizes. */ layout_fix_offsets(lc); layout_fix_panes(w); - - /* Then resize the layout back to the original window size. */ - layout_resize(w, sx, sy); - window_resize(w, sx, sy); + recalculate_sizes(); layout_print_cell(lc, __func__, 0); -- cgit From b12df0186139bb4761292629871205dc46d4c302 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 12 Jun 2019 08:47:07 +0000 Subject: Pass target on to new commands with if -F. --- cmd-if-shell.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 84f66657..f795575a 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -67,10 +67,11 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) struct cmd_if_shell_data *cdata; char *shellcmd, *cmd; struct cmdq_item *new_item; + struct cmd_find_state *fs = &item->target; struct client *c = cmd_find_client(item, NULL, 1); - struct session *s = item->target.s; - struct winlink *wl = item->target.wl; - struct window_pane *wp = item->target.wp; + struct session *s = fs->s; + struct winlink *wl = fs->wl; + struct window_pane *wp = fs->wp; struct cmd_parse_input pi; struct cmd_parse_result *pr; @@ -92,7 +93,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) pi.line = self->line; pi.item = item; pi.c = c; - cmd_find_copy_state(&pi.fs, &item->target); + cmd_find_copy_state(&pi.fs, fs); pr = cmd_parse_from_string(cmd, &pi); switch (pr->status) { @@ -103,7 +104,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) free(pr->error); return (CMD_RETURN_ERROR); case CMD_PARSE_SUCCESS: - new_item = cmdq_get_command(pr->cmdlist, NULL, m, 0); + new_item = cmdq_get_command(pr->cmdlist, fs, m, 0); cmdq_insert_after(item, new_item); cmd_list_free(pr->cmdlist); break; @@ -137,7 +138,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) cdata->input.c = c; if (cdata->input.c != NULL) cdata->input.c->references++; - cmd_find_copy_state(&cdata->input.fs, &item->target); + cmd_find_copy_state(&cdata->input.fs, fs); if (job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL, cmd_if_shell_callback, cmd_if_shell_free, cdata, 0) == NULL) { -- cgit From 7e6a26cc9d857ffc53fdb2395aa5413ff1865f9e Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 12 Jun 2019 09:10:29 +0000 Subject: Do not use $TMUX to find the session because for windows in multiple sessions it is wrong as often as it is right, and for windows in one session it is pointless. Instead check TMUX_PANE to find the pane and look for the MRU session as usual. GitHub issue 1793. --- cmd-find.c | 73 ++++++++------------------------------------------------------ 1 file changed, 9 insertions(+), 64 deletions(-) diff --git a/cmd-find.c b/cmd-find.c index e5ef8b99..e3e14f55 100644 --- a/cmd-find.c +++ b/cmd-find.c @@ -76,38 +76,12 @@ stat