From 8b604e06c4ab305ef18faa0df67d0223897265e1 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Fri, 17 Dec 2021 16:55:16 +0200 Subject: App: Fixed links opening in the wrong split Switching the current root may change which DocumentWidget the `open` command affects. --- src/app.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/app.c') diff --git a/src/app.c b/src/app.c index 86ef8b73..feabcf7f 100644 --- a/src/app.c +++ b/src/app.c @@ -2743,13 +2743,14 @@ iBool handleCommand_App(const char *cmd) { root = otherRoot_Window(as_Window(d->window), root); setKeyRoot_Window(as_Window(d->window), root); setCurrent_Root(root); /* need to change for widget creation */ + doc = document_Command(cmd); /* may be different */ } if (newTab & (new_OpenTabFlag | newBackground_OpenTabFlag)) { doc = newTab_App(NULL, (newTab & new_OpenTabFlag) != 0); /* `newtab:2` to open in background */ } - iHistory *history = history_DocumentWidget(doc); - const iBool isHistory = argLabel_Command(cmd, "history") != 0; - int redirectCount = argLabel_Command(cmd, "redirect"); + iHistory *history = history_DocumentWidget(doc); + const iBool isHistory = argLabel_Command(cmd, "history") != 0; + int redirectCount = argLabel_Command(cmd, "redirect"); if (!isHistory) { if (redirectCount) { replace_History(history, url); -- cgit v1.2.3