Rename CommandValue.tab to CommandValue.cur_tab

This commit is contained in:
Florian Bruhin 2018-11-30 15:43:14 +01:00
parent 3a7206bda1
commit 3abc83d945
6 changed files with 22 additions and 22 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -262,7 +262,7 @@ class CommandValue(enum.Enum):
count = 1
win_id = 2
tab = 3
cur_tab = 3
class Question(QObject):