summaryrefslogtreecommitdiffstats
path: root/cmd-select-pane.c
diff options
context:
space:
mode:
authornicm <nicm>2023-07-10 09:24:53 +0000
committernicm <nicm>2023-07-10 09:24:53 +0000
commit8b3e2eab5afde62a4eb87b132b4196105c1cfaa6 (patch)
treea415a80c46eb31a10948b95064c81e4d9faf7be1 /cmd-select-pane.c
parentb7e22d00b4530ecf6b86884c0f27cbad38a6345c (diff)
Use a stack for last panes line windows, from Thomas Bertschinger in
GitHub issue 3588.
Diffstat (limited to 'cmd-select-pane.c')
-rw-r--r--cmd-select-pane.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index ae21d4ce..135729f5 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -98,7 +98,11 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
struct options_entry *o;
if (entry == &cmd_last_pane_entry || args_has(args, 'l')) {
- lastwp = w->last;
+ /*
+ * Check for no last pane found in case the other pane was
+ * spawned without being visited (for example split-window -d).
+ */
+ lastwp = TAILQ_FIRST(&w->last_panes);
if (lastwp == NULL && window_count_panes(w) == 2) {
lastwp = TAILQ_PREV(w->active, window_panes, entry);
if (lastwp == NULL)