From 8b3e2eab5afde62a4eb87b132b4196105c1cfaa6 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 10 Jul 2023 09:24:53 +0000 Subject: Use a stack for last panes line windows, from Thomas Bertschinger in GitHub issue 3588. --- cmd-select-pane.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmd-select-pane.c') 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) -- cgit v1.2.3