Merge remote-tracking branch 'origin/pr/3581'

This commit is contained in:
Florian Bruhin 2018-02-11 11:16:20 +01:00
commit 9c4564fd70

View File

@ -533,14 +533,19 @@ class CommandDispatcher:
@cmdutils.register(instance='command-dispatcher', scope='window') @cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('win_id', completion=miscmodels.window) @cmdutils.argument('win_id', completion=miscmodels.window)
def tab_give(self, win_id: int = None): @cmdutils.argument('count', count=True)
def tab_give(self, win_id: int = None, count=None):
"""Give the current tab to a new or existing window if win_id given. """Give the current tab to a new or existing window if win_id given.
If no win_id is given, the tab will get detached into a new window. If no win_id is given, the tab will get detached into a new window.
Args: Args:
win_id: The window ID of the window to give the current tab to. win_id: The window ID of the window to give the current tab to.
count: [count] overrides win_id (index starts at 1 for win_id=0)
""" """
if count is not None:
win_id = count - 1
if win_id == self._win_id: if win_id == self._win_id:
raise cmdexc.CommandError("Can't give a tab to the same window") raise cmdexc.CommandError("Can't give a tab to the same window")