summaryrefslogtreecommitdiffstats
path: root/cmd-select-pane.c
diff options
context:
space:
mode:
authornicm <nicm>2018-06-25 17:23:16 +0000
committernicm <nicm>2018-06-25 17:23:16 +0000
commit0c94c3fbee3df39293de8b7fd957392251113a74 (patch)
treeb100507308d6e6b1b159e52d696d1b9c44951d94 /cmd-select-pane.c
parentdec6ec9e29033cb4739b9eec5f3a5c68dece878a (diff)
If there are only two panes, always use the other pane as the last
pane. Based on a change from Duy Nguyen in GitHub issue 1377.
Diffstat (limited to 'cmd-select-pane.c')
-rw-r--r--cmd-select-pane.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index 790a1a5b..a2345fe1 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -69,6 +69,11 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
lastwp = w->last;
+ if (lastwp == NULL && window_count_panes(w) == 2) {
+ lastwp = TAILQ_PREV(w->active, window_panes, entry);
+ if (lastwp == NULL)
+ lastwp = TAILQ_NEXT(w->active, entry);
+ }
if (lastwp == NULL) {
cmdq_error(item, "no last pane");
return (CMD_RETURN_ERROR);