Ensure that a window with the given win_id exists

This commit is contained in:
Michael Hoang 2017-10-22 08:22:45 +11:00
parent 34fc5335d9
commit e5f2d27ed9
2 changed files with 9 additions and 0 deletions

View File

@ -555,6 +555,10 @@ class CommandDispatcher:
tabbed_browser = self._new_tabbed_browser(
private=self._tabbed_browser.private)
else:
if win_id not in objreg.window_registry:
raise cmdexc.CommandError(
"There's no window with id {}!".format(win_id))
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=win_id)

View File

@ -1058,6 +1058,11 @@ Feature: Tab management
And I run :tab-give
Then the error "Cannot detach from a window with only one tab" should be shown
Scenario: Give a tab to a window ID that does not exist
When I open data/hello.txt
And I run :tab-give 99
Then the error "There's no window with id 99!" should be shown
# Other
Scenario: Using :tab-next after closing last tab (#1448)