From 47451aa495172f8faf34408b0fdd49424d9999c3 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 12 Feb 2018 23:00:26 +0100 Subject: [PATCH] Open qute://tabs with :buffer --- doc/help/commands.asciidoc | 2 +- qutebrowser/browser/commands.py | 9 ++++++--- tests/end2end/features/tabs.feature | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index c5f013491..9580fe578 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -221,7 +221,7 @@ Syntax: +:buffer ['index']+ 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 * +'index'+: The [win_id/]index of the tab to focus. Or a substring in which case the closest match will be focused. diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index b56c3d6ae..3e2eeaecb 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1086,20 +1086,23 @@ class CommandDispatcher: maxsplit=0) @cmdutils.argument('index', completion=miscmodels.buffer) @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. 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. + Args: index: The [win_id/]index of the tab to focus. Or a substring in which case the closest match will be focused. count: The tab index to focus, starting with 1. """ if count is None and index is None: - raise cmdexc.CommandError("buffer: Either a count or the argument " - "index must be specified.") + self.openurl('qute://tabs/', tab=True) + return if count is not None: index = str(count) diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index 065b92096..037e1cdd0 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -904,7 +904,7 @@ Feature: Tab management Scenario: :buffer without args or count 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 When I open data/title.html