Give error when trying to detach a single tab

This commit is contained in:
Michael Hoang 2016-08-16 07:36:39 +10:00
parent 5c766ff7da
commit c0ab474b21
2 changed files with 8 additions and 0 deletions

View File

@ -424,6 +424,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()

View File

@ -620,6 +620,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