From 5d11a1fd75dc1651ba3e58284e9a117d1c67c435 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Tue, 17 Oct 2017 11:19:37 -0400 Subject: [PATCH] Prevent :home from bypassing pinned tab warnings Closes #3138 --- qutebrowser/browser/commands.py | 6 +++++- tests/end2end/features/tabs.feature | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 7f4b079c2..256894d49 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -353,6 +353,10 @@ class CommandDispatcher: Return: A list of URLs that can be opened. """ + if isinstance(url, QUrl): + yield url + return + force_search = False urllist = [u for u in url.split('\n') if u.strip()] if (len(urllist) > 1 and not urlutils.is_url(urllist[0]) and @@ -1210,7 +1214,7 @@ class CommandDispatcher: @cmdutils.register(instance='command-dispatcher', scope='window') def home(self): """Open main startpage in current tab.""" - self._current_widget().openurl(config.val.url.start_pages[0]) + self.openurl(config.val.url.start_pages[0]) def _run_userscript(self, cmd, *args, verbose=False): """Run a userscript given as argument. diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index 8a3c38775..c516bfaa7 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -1197,6 +1197,14 @@ Feature: Tab management And the following tabs should be open: - data/numbers/1.txt (active) (pinned) + Scenario: :tab-pin open url + When I open data/numbers/1.txt + And I run :tab-pin + And I run :home + Then the message "Tab is pinned!" should be shown + And the following tabs should be open: + - data/numbers/1.txt (active) (pinned) + Scenario: Cloning a pinned tab When I open data/numbers/1.txt And I run :tab-pin