diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 32eb80c69..76e1075a1 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -212,7 +212,18 @@ class CommandDispatcher: "{!r}!".format(conf_selection)) return None - def _tab_close(self, tab, left=False, right=False, opposite=False, count=None): + def _tab_close(self, tab, left=False, right=False, opposite=False): + """Helper function for tab_close be able to handle message.async. + + Args: + tab: Tab select to be closed. + left: Force selecting the tab to the left of the current tab. + right: Force selecting the tab to the right of the current tab. + opposite: Force selecting the tab in the opposite direction of + what's configured in 'tabs->select-on-remove'. + count: The tab index to close, or None + + """ tabbar = self._tabbed_browser.tabBar() selection_override = self._get_selection_override(left, right, opposite) @@ -224,7 +235,6 @@ class CommandDispatcher: self._tabbed_browser.close_tab(tab) tabbar.setSelectionBehaviorOnRemove(old_selection_behavior) - @cmdutils.register(instance='command-dispatcher', scope='window') @cmdutils.argument('count', count=True) def tab_close(self, left=False, right=False, opposite=False, count=None): @@ -238,12 +248,11 @@ class CommandDispatcher: count: The tab index to close, or None """ tab = self._cntwidget(count) - result = True if tab is None: return close = functools.partial(self._tab_close, tab, left, - right, opposite, count) + right, opposite) if tab.data.pinned: message.confirm_async(title='Pinned Tab', @@ -252,8 +261,6 @@ class CommandDispatcher: else: close() - - @cmdutils.register(instance='command-dispatcher', scope='window', name='tab-pin') @cmdutils.argument('index')