From 3abc83d945794584483277e3050be1e4ab4cb16d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 30 Nov 2018 15:43:14 +0100 Subject: [PATCH] Rename CommandValue.tab to CommandValue.cur_tab --- doc/contributing.asciidoc | 2 +- qutebrowser/commands/command.py | 2 +- qutebrowser/components/caretcommands.py | 24 ++++++++++++------------ qutebrowser/components/scrollcommands.py | 8 ++++---- qutebrowser/components/zoomcommands.py | 6 +++--- qutebrowser/utils/usertypes.py | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/contributing.asciidoc b/doc/contributing.asciidoc index b11014ca1..dc52dd9a0 100644 --- a/doc/contributing.asciidoc +++ b/doc/contributing.asciidoc @@ -483,7 +483,7 @@ The following arguments are supported for `@cmdutils.argument`: - `value`: Tell qutebrowser to fill the argument with special values: - `value=cmdutils.Value.count`: The `count` given by the user to the command. - `value=cmdutils.Value.win_id`: The window ID of the current window. - - `value=cmdutils.Value.tab`: The tab object which is currently focused. + - `value=cmdutils.Value.cur_tab`: The tab object which is currently focused. - `completion`: A completion function (see `qutebrowser.completions.models.*`) to use when completing arguments for the given command. - `choices`: The allowed string choices for the argument. diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index 631ecc354..a91a268bd 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -441,7 +441,7 @@ class Command: self._add_special_arg(value=win_id, param=param, args=args, kwargs=kwargs) continue - elif arg_info.value == usertypes.CommandValue.tab: + elif arg_info.value == usertypes.CommandValue.cur_tab: tab = self._get_objreg(win_id=win_id, name='tab', scope='tab') self._add_special_arg(value=tab, param=param, args=args, kwargs=kwargs) diff --git a/qutebrowser/components/caretcommands.py b/qutebrowser/components/caretcommands.py index ae0828ef5..c359c27ac 100644 --- a/qutebrowser/components/caretcommands.py +++ b/qutebrowser/components/caretcommands.py @@ -24,7 +24,7 @@ from qutebrowser.api import cmdutils, apitypes @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_next_line(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the next line. @@ -36,7 +36,7 @@ def move_to_next_line(tab: apitypes.Tab, count: int = 1): @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_prev_line(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the prev line. @@ -48,7 +48,7 @@ def move_to_prev_line(tab: apitypes.Tab, count: int = 1): @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_next_char(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the next char. @@ -60,7 +60,7 @@ def move_to_next_char(tab: apitypes.Tab, count: int = 1): @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_prev_char(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the previous char. @@ -72,7 +72,7 @@ def move_to_prev_char(tab: apitypes.Tab, count: int = 1): @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_end_of_word(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the end of the word. @@ -84,7 +84,7 @@ def move_to_end_of_word(tab: apitypes.Tab, count: int = 1): @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_next_word(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the next word. @@ -96,7 +96,7 @@ def move_to_next_word(tab: apitypes.Tab, count: int = 1): @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_prev_word(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the previous word. @@ -120,7 +120,7 @@ def move_to_end_of_line(tab: apitypes.Tab): @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_start_of_next_block(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the start of next block. @@ -132,7 +132,7 @@ def move_to_start_of_next_block(tab: apitypes.Tab, count: int = 1): @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_start_of_prev_block(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the start of previous block. @@ -144,7 +144,7 @@ def move_to_start_of_prev_block(tab: apitypes.Tab, count: int = 1): @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_end_of_next_block(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the end of next block. @@ -156,7 +156,7 @@ def move_to_end_of_next_block(tab: apitypes.Tab, count: int = 1): @cmdutils.register(modes=[cmdutils.KeyMode.caret]) -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def move_to_end_of_prev_block(tab: apitypes.Tab, count: int = 1): """Move the cursor or selection to the end of previous block. @@ -192,7 +192,7 @@ def drop_selection(tab: apitypes.Tab): @cmdutils.register() -@cmdutils.argument('tab_obj', value=cmdutils.Value.tab) +@cmdutils.argument('tab_obj', value=cmdutils.Value.cur_tab) def follow_selected(tab_obj: apitypes.Tab, *, tab=False): """Follow the selected text. diff --git a/qutebrowser/components/scrollcommands.py b/qutebrowser/components/scrollcommands.py index c749c5dbe..4a6d9cb99 100644 --- a/qutebrowser/components/scrollcommands.py +++ b/qutebrowser/components/scrollcommands.py @@ -23,7 +23,7 @@ from qutebrowser.api import cmdutils, apitypes @cmdutils.register() -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def scroll_px(tab: apitypes.Tab, dx: int, dy: int, count: int = 1) -> None: """Scroll the current tab by 'count * dx/dy' pixels. @@ -41,7 +41,7 @@ def scroll_px(tab: apitypes.Tab, dx: int, dy: int, count: int = 1) -> None: @cmdutils.register() -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def scroll(tab: apitypes.Tab, direction: str, count: int = 1) -> None: """Scroll the current tab in the given direction. @@ -79,7 +79,7 @@ def scroll(tab: apitypes.Tab, direction: str, count: int = 1) -> None: @cmdutils.register() -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) @cmdutils.argument('horizontal', flag='x') def scroll_to_perc(tab: apitypes.Tab, count: int = None, @@ -111,7 +111,7 @@ def scroll_to_perc(tab: apitypes.Tab, count: int = None, @cmdutils.register() -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) def scroll_to_anchor(tab: apitypes.Tab, name): """Scroll to the given anchor in the document. diff --git a/qutebrowser/components/zoomcommands.py b/qutebrowser/components/zoomcommands.py index c525b771c..16afa18e2 100644 --- a/qutebrowser/components/zoomcommands.py +++ b/qutebrowser/components/zoomcommands.py @@ -23,7 +23,7 @@ from qutebrowser.api import cmdutils, apitypes, message, config @cmdutils.register() -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def zoom_in(tab: apitypes.Tab, count=1, quiet=False): """Increase the zoom level for the current tab. @@ -41,7 +41,7 @@ def zoom_in(tab: apitypes.Tab, count=1, quiet=False): @cmdutils.register() -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def zoom_out(tab: apitypes.Tab, count=1, quiet=False): """Decrease the zoom level for the current tab. @@ -59,7 +59,7 @@ def zoom_out(tab: apitypes.Tab, count=1, quiet=False): @cmdutils.register() -@cmdutils.argument('tab', value=cmdutils.Value.tab) +@cmdutils.argument('tab', value=cmdutils.Value.cur_tab) @cmdutils.argument('count', value=cmdutils.Value.count) def zoom(tab: apitypes.Tab, zoom=None, count=None, quiet=False): """Set the zoom level for the current tab. diff --git a/qutebrowser/utils/usertypes.py b/qutebrowser/utils/usertypes.py index c6fddb039..eb19b9dd3 100644 --- a/qutebrowser/utils/usertypes.py +++ b/qutebrowser/utils/usertypes.py @@ -262,7 +262,7 @@ class CommandValue(enum.Enum): count = 1 win_id = 2 - tab = 3 + cur_tab = 3 class Question(QObject):