From 75ec17f0b5204a12d15282a5167918416cd05276 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Sat, 31 Aug 2013 11:16:47 +0100 Subject: [PATCH 1/6] Mark flags as optional and mutually exclusive. --- cmd-wait-for.c | 2 +- tmux.1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd-wait-for.c b/cmd-wait-for.c index e87e197a..e251863d 100644 --- a/cmd-wait-for.c +++ b/cmd-wait-for.c @@ -33,7 +33,7 @@ enum cmd_retval cmd_wait_for_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_wait_for_entry = { "wait-for", "wait", "LSU", 1, 1, - "[-LSU] channel", + "[-L|-S|-U] channel", 0, NULL, cmd_wait_for_exec diff --git a/tmux.1 b/tmux.1 index ede1bb20..0b7d45f7 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3582,7 +3582,7 @@ If the command doesn't return success, the exit status is also displayed. .D1 (alias: Ic info ) Show server information and terminal details. .It Xo Ic wait-for -.Fl LSU +.Op Fl L | S | U .Ar channel .Xc .D1 (alias: Ic wait ) From bda970b3b14d145fcaa25cf8f3f9a3cb70a864c3 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 26 Sep 2013 12:00:48 +0100 Subject: [PATCH 2/6] Don't treat TMUX_TMPDIR as a potential file The point of setting TMUX_TMPDIR is to then make any labels from -L go to that directory. In the case of makesocketpath() with no TMUX_TMPDIR set, would set both the path and the default socket to a file. The checking of the permissions on the file worked fine in that case, but when TMUX_TMPDIR is set, won't work on a directory. This fixes the problem by ensuring the check on the permissions is performed on directories only. --- tmux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tmux.c b/tmux.c index 606c574f..9c81cff5 100644 --- a/tmux.c +++ b/tmux.c @@ -184,7 +184,8 @@ makesocketpath(const char *label) errno = ENOTDIR; return (NULL); } - if (sb.st_uid != uid || (sb.st_mode & (S_IRWXG|S_IRWXO)) != 0) { + if (sb.st_uid != uid || (!S_ISDIR(sb.st_mode) && + sb.st_mode & (S_IRWXG|S_IRWXO)) != 0) { errno = EACCES; return (NULL); } @@ -387,7 +388,8 @@ main(int argc, char **argv) /* -L or default set. */ if (label != NULL) { if ((path = makesocketpath(label)) == NULL) { - fprintf(stderr, "can't create socket\n"); + fprintf(stderr, "can't create socket: %s\n", + strerror(errno)); exit(1); } } From 21bca549d35b3d0b4ff1f22f66e5e108c103ac4b Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 10 Sep 2013 13:17:39 +0100 Subject: [PATCH 3/6] layout-resize-pane-mouse: Consider visible panes only When a pane is maximized, and text is selected, we end up checking if a pane switch is needed. This therefore means we might end up selecting panes which aren't visible. --- layout.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/layout.c b/layout.c index b74bd789..cf554c38 100644 --- a/layout.c +++ b/layout.c @@ -533,6 +533,9 @@ layout_resize_pane_mouse(struct client *c) pane_border = 0; if (m->event & MOUSE_EVENT_DRAG && m->flags & MOUSE_RESIZE_PANE) { TAILQ_FOREACH(wp, &w->panes, entry) { + if (!window_pane_visible(wp)) + continue; + if (wp->xoff + wp->sx == m->lx && wp->yoff <= 1 + m->ly && wp->yoff + wp->sy >= m->ly) { From 884a21d0f5b5b5b1d19a84b3e2f40a42a0b6105c Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 1 Oct 2013 23:24:39 +0100 Subject: [PATCH 4/6] First period not last for host_short, from Michael Scholz. --- format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/format.c b/format.c index da939f04..ba4b95b2 100644 --- a/format.c +++ b/format.c @@ -121,7 +121,7 @@ format_create(void) if (gethostname(host, sizeof host) == 0) { format_add(ft, "host", "%s", host); - if ((ptr = strrchr(host, '.')) != NULL) + if ((ptr = strchr(host, '.')) != NULL) *ptr = '\0'; format_add(ft, "host_short", "%s", host); } From d0fa48db1eaea5fc2fa62111c2bfb4836f2b5f03 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 1 Oct 2013 23:27:36 +0100 Subject: [PATCH 5/6] Restore missing key binding for %, from Chris Johnsen. --- cmd-split-window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd-split-window.c b/cmd-split-window.c index 5b5140be..40f7966b 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -36,7 +36,7 @@ const struct cmd_entry cmd_split_window_entry = { "[-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] " CMD_TARGET_PANE_USAGE " [command]", 0, - NULL, + cmd_split_window_key_binding, cmd_split_window_exec }; From 7be152412ea0a614df11bce9ba5097574369a5f6 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 1 Oct 2013 23:31:09 +0100 Subject: [PATCH 6/6] Make cmdq->client_exit a tristate (-1 means "not set") so that if explicitly set it can be copied from child to parent cmdq by if-shell and source-file. This fixes using attach or new. From Chris Johnsen. --- cmd-if-shell.c | 3 +++ cmd-queue.c | 4 ++-- cmd-source-file.c | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd-if-shell.c b/cmd-if-shell.c index a074341b..9b6dcf30 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -147,6 +147,9 @@ cmd_if_shell_done(struct cmd_q *cmdq1) struct cmd_if_shell_data *cdata = cmdq1->data; struct cmd_q *cmdq = cdata->cmdq; + if (cmdq1->client_exit >= 0) + cmdq->client_exit = cmdq1->client_exit; + if (!cmdq_free(cmdq) && !cdata->bflag) cmdq_continue(cmdq); diff --git a/cmd-queue.c b/cmd-queue.c index 38a88d23..19d98190 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -35,7 +35,7 @@ cmdq_new(struct client *c) cmdq->dead = 0; cmdq->client = c; - cmdq->client_exit = 0; + cmdq->client_exit = -1; TAILQ_INIT(&cmdq->queue); cmdq->item = NULL; @@ -259,7 +259,7 @@ cmdq_continue(struct cmd_q *cmdq) } while (cmdq->item != NULL); empty: - if (cmdq->client_exit) + if (cmdq->client_exit > 0) cmdq->client->flags |= CLIENT_EXIT; if (cmdq->emptyfn != NULL) cmdq->emptyfn(cmdq); /* may free cmdq */ diff --git a/cmd-source-file.c b/cmd-source-file.c index d636643d..eb7e1490 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -95,6 +95,9 @@ cmd_source_file_done(struct cmd_q *cmdq1) { struct cmd_q *cmdq = cmdq1->data; + if (cmdq1->client_exit >= 0) + cmdq->client_exit = cmdq1->client_exit; + cmdq_free(cmdq1); cfg_references--;