diff options
author | Michael Hoang <enzime@users.noreply.github.com> | 2016-08-16 07:36:39 +1000 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2016-11-05 22:19:17 +0100 |
commit | 552198ac31f93a801eb8bcc6eb4445bb2074f0ab (patch) | |
tree | 255d999164f0351df732b3735ae09110ee3e47d0 | |
parent | 1222394efdcfa7337109a6fa09424dc379bc2848 (diff) | |
download | qutebrowser-552198ac31f93a801eb8bcc6eb4445bb2074f0ab.tar.gz qutebrowser-552198ac31f93a801eb8bcc6eb4445bb2074f0ab.zip |
Give error when trying to detach a single tab
-rw-r--r-- | qutebrowser/browser/commands.py | 2 | ||||
-rw-r--r-- | tests/end2end/features/tabs.feature | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 7838e0138..d86a8b12b 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -377,6 +377,8 @@ class CommandDispatcher: @cmdutils.register(instance='command-dispatcher', scope='window') def tab_detach(self): """Detach the current tab to its own window.""" + if self._count() < 2: + raise cmdexc.CommandError("Cannot detach one tab.") url = self._current_url() self._open(url, window=True) cur_widget = self._current_widget() diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index c4e137fe3..579ef4190 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -562,6 +562,12 @@ Feature: Tab management - history: - url: http://localhost:*/data/numbers/2.txt + Scenario: Detach tab from window with only one tab + Given I have a fresh instance + When I open data/hello.txt + And I run :tab-detach + Then the error "Cannot detach one tab." should be shown + # :undo Scenario: Undo without any closed tabs |