Open qute://tabs with :buffer

This commit is contained in:
Florian Bruhin 2018-02-12 23:00:26 +01:00
parent 9f163d90e1
commit 47451aa495
3 changed files with 8 additions and 5 deletions

View File

@ -221,7 +221,7 @@ Syntax: +:buffer ['index']+
Select tab by index or url/title best match. Select tab by index or url/title best match.
Focuses window if necessary when index is given. If both index and count are given, use count. Focuses window if necessary when index is given. If both index and count are given, use count. With neither index nor count given, open the qute://tabs page.
==== positional arguments ==== positional arguments
* +'index'+: The [win_id/]index of the tab to focus. Or a substring in which case the closest match will be focused. * +'index'+: The [win_id/]index of the tab to focus. Or a substring in which case the closest match will be focused.

View File

@ -1086,20 +1086,23 @@ class CommandDispatcher:
maxsplit=0) maxsplit=0)
@cmdutils.argument('index', completion=miscmodels.buffer) @cmdutils.argument('index', completion=miscmodels.buffer)
@cmdutils.argument('count', count=True) @cmdutils.argument('count', count=True)
def buffer(self, index=None, count=None): @cmdutils.argument('win_id', win_id=True)
def buffer(self, win_id, index=None, count=None):
"""Select tab by index or url/title best match. """Select tab by index or url/title best match.
Focuses window if necessary when index is given. If both index and Focuses window if necessary when index is given. If both index and
count are given, use count. count are given, use count.
With neither index nor count given, open the qute://tabs page.
Args: Args:
index: The [win_id/]index of the tab to focus. Or a substring index: The [win_id/]index of the tab to focus. Or a substring
in which case the closest match will be focused. in which case the closest match will be focused.
count: The tab index to focus, starting with 1. count: The tab index to focus, starting with 1.
""" """
if count is None and index is None: if count is None and index is None:
raise cmdexc.CommandError("buffer: Either a count or the argument " self.openurl('qute://tabs/', tab=True)
"index must be specified.") return
if count is not None: if count is not None:
index = str(count) index = str(count)

View File

@ -904,7 +904,7 @@ Feature: Tab management
Scenario: :buffer without args or count Scenario: :buffer without args or count
When I run :buffer When I run :buffer
Then the error "buffer: Either a count or the argument index must be specified." should be shown Then qute://tabs should be loaded
Scenario: :buffer with a matching title Scenario: :buffer with a matching title
When I open data/title.html When I open data/title.html