From 8b5d5dca9f8fcb7832c48baeef10a0320776b30c Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 17 Sep 2015 14:11:55 +0000 Subject: [PATCH 1/4] Redraw both src and dst sessions in break-pane. --- cmd-break-pane.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/cmd-break-pane.c b/cmd-break-pane.c index c7af7865..2aa5c5b7 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -43,7 +43,8 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; struct winlink *wl; - struct session *s; + struct session *src_s; + struct session *dst_s; struct window_pane *wp; struct window *w; char *name; @@ -53,28 +54,28 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) const char *template; char *cp; - if ((wl = cmd_find_pane(cmdq, args_get(args, 's'), &s, &wp)) == NULL) + wl = cmd_find_pane(cmdq, args_get(args, 's'), &src_s, &wp); + if (wl == NULL) return (CMD_RETURN_ERROR); - if ((idx = cmd_find_index(cmdq, args_get(args, 't'), &s)) == -2) + if ((idx = cmd_find_index(cmdq, args_get(args, 't'), &dst_s)) == -2) return (CMD_RETURN_ERROR); - if (idx != -1 && winlink_find_by_index(&s->windows, idx) != NULL) { + if (idx != -1 && winlink_find_by_index(&dst_s->windows, idx) != NULL) { cmdq_error(cmdq, "index %d already in use", idx); return (CMD_RETURN_ERROR); } + w = wl->window; - if (window_count_panes(wl->window) == 1) { + if (window_count_panes(w) == 1) { cmdq_error(cmdq, "can't break with only one pane"); return (CMD_RETURN_ERROR); } - - w = wl->window; server_unzoom_window(w); TAILQ_REMOVE(&w->panes, wp, entry); window_lost_pane(w, wp); layout_close_pane(wp); - w = wp->window = window_create1(s->sx, s->sy); + w = wp->window = window_create1(dst_s->sx, dst_s->sy); TAILQ_INSERT_HEAD(&w->panes, wp, entry); w->active = wp; name = default_window_name(w); @@ -83,20 +84,25 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) layout_init(w, wp); if (idx == -1) - idx = -1 - options_get_number(&s->options, "base-index"); - wl = session_attach(s, w, idx, &cause); /* can't fail */ + idx = -1 - options_get_number(&dst_s->options, "base-index"); + wl = session_attach(dst_s, w, idx, &cause); /* can't fail */ if (!args_has(self->args, 'd')) - session_select(s, wl->idx); + session_select(dst_s, wl->idx); - server_redraw_session(s); - server_status_session_group(s); + server_redraw_session(src_s); + if (src_s != dst_s) + server_redraw_session(dst_s); + server_status_session_group(src_s); + if (src_s != dst_s) + server_status_session_group(dst_s); if (args_has(args, 'P')) { if ((template = args_get(args, 'F')) == NULL) template = BREAK_PANE_TEMPLATE; ft = format_create(); - format_defaults(ft, cmd_find_client(cmdq, NULL, 1), s, wl, wp); + format_defaults(ft, cmd_find_client(cmdq, NULL, 1), dst_s, wl, + wp); cp = format_expand(ft, template); cmdq_print(cmdq, "%s", cp); From 6b709e655e52a302f537d6995affdbaf4e8ef0f1 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 18 Sep 2015 09:55:22 +0000 Subject: [PATCH 2/4] -l should apply to the new not the old pane with -b, from "MadMaverick9" on GitHub. --- layout.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/layout.c b/layout.c index bb1bbf8d..266d1f39 100644 --- a/layout.c +++ b/layout.c @@ -686,6 +686,8 @@ layout_split_pane( case LAYOUT_LEFTRIGHT: if (size < 0) size2 = ((sx + 1) / 2) - 1; + else if (insert_before) + size2 = sx - size - 1; else size2 = size; if (size2 < PANE_MINIMUM) @@ -699,6 +701,8 @@ layout_split_pane( case LAYOUT_TOPBOTTOM: if (size < 0) size2 = ((sy + 1) / 2) - 1; + else if (insert_before) + size2 = sy - size - 1; else size2 = size; if (size2 < PANE_MINIMUM) From d5f223a3fec0b0ccf69f17e3515a20c79ec28e6e Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 21 Sep 2015 09:34:52 +0000 Subject: [PATCH 3/4] Reset the alerts timer always on activity, from Thomas Adam. --- alerts.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alerts.c b/alerts.c index 5d52f7ad..806e565b 100644 --- a/alerts.c +++ b/alerts.c @@ -126,6 +126,9 @@ alerts_reset(struct window *w) void alerts_queue(struct window *w, int flags) { + if (w->flags & WINDOW_ACTIVITY) + alerts_reset(w); + if (!event_initialized(&w->alerts_timer)) evtimer_set(&w->alerts_timer, alerts_timer, w); @@ -139,9 +142,6 @@ alerts_queue(struct window *w, int flags) event_once(-1, EV_TIMEOUT, alerts_callback, NULL, NULL); alerts_fired = 1; } - - if (flags & WINDOW_ACTIVITY) - alerts_reset(w); } int From dc66795e353e1d84c23cb87f4120480a152b43d9 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 22 Sep 2015 21:56:16 +0000 Subject: [PATCH 4/4] Don't update last session when the session is unchanged, from Sina Siadat. --- cmd-switch-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd-switch-client.c b/cmd-switch-client.c index 10171018..3a72886a 100644 --- a/cmd-switch-client.c +++ b/cmd-switch-client.c @@ -124,7 +124,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq) environ_update(update, &c->environ, &s->environ); } - if (c->session != NULL) + if (c->session != NULL && c->session != s) c->last_session = c->session; c->session = s; status_timer_start(c);