diff --git a/src/lib/navigation/completer/locationcompletermodel.cpp b/src/lib/navigation/completer/locationcompletermodel.cpp index 7aff40a80..869a0f65f 100644 --- a/src/lib/navigation/completer/locationcompletermodel.cpp +++ b/src/lib/navigation/completer/locationcompletermodel.cpp @@ -206,13 +206,16 @@ TabPosition LocationCompleterModel::tabPositionForUrl(const QUrl& url) const TabPosition LocationCompleterModel::tabPositionForEncodedUrl(const QString& encodedUrl) const { - for(int win=0; win < mApp->windowCount(); ++win) { - QupZilla* mainWin = mApp->mainWindows().at(win); + QList windows = mApp->mainWindows(); + int currentWindowIdx = windows.indexOf(mApp->getWindow()); + windows.prepend(mApp->getWindow()); + for(int win=0; win < windows.count(); ++win) { + QupZilla* mainWin = windows.at(win); QList tabs = mainWin->tabWidget()->allTabs(); for(int tab=0; tab < tabs.count(); ++tab) { if(tabs[tab]->url().toEncoded() == encodedUrl) { TabPosition pos; - pos.windowIndex = win; + pos.windowIndex = win == 0 ? currentWindowIdx : win-1; pos.tabIndex = tab; return pos; } diff --git a/src/lib/navigation/completer/locationcompleterview.cpp b/src/lib/navigation/completer/locationcompleterview.cpp index 58164630d..01af2e2e5 100644 --- a/src/lib/navigation/completer/locationcompleterview.cpp +++ b/src/lib/navigation/completer/locationcompleterview.cpp @@ -23,6 +23,7 @@ #include "history.h" #include "tabwidget.h" #include "qzsettings.h" +#include "tabbedwebview.h" #include #include @@ -277,4 +278,7 @@ void LocationCompleterView::activateTab(TabPosition pos) win->activateWindow(); win->raise(); } + else { + win->weView()->setFocus(); + } }