Clearly separate yesno/prompt key modes
This commit is contained in:
parent
d9ae3fd5aa
commit
01462008c9
@ -2379,8 +2379,6 @@ bindings.default:
|
|||||||
<Escape>: leave-mode
|
<Escape>: leave-mode
|
||||||
prompt:
|
prompt:
|
||||||
<Return>: prompt-accept
|
<Return>: prompt-accept
|
||||||
y: prompt-accept yes
|
|
||||||
n: prompt-accept no
|
|
||||||
<Ctrl-X>: prompt-open-download
|
<Ctrl-X>: prompt-open-download
|
||||||
<Shift-Tab>: prompt-item-focus prev
|
<Shift-Tab>: prompt-item-focus prev
|
||||||
<Up>: prompt-item-focus prev
|
<Up>: prompt-item-focus prev
|
||||||
@ -2403,6 +2401,14 @@ bindings.default:
|
|||||||
<Ctrl-H>: rl-backward-delete-char
|
<Ctrl-H>: rl-backward-delete-char
|
||||||
<Ctrl-Y>: rl-yank
|
<Ctrl-Y>: rl-yank
|
||||||
<Escape>: leave-mode
|
<Escape>: leave-mode
|
||||||
|
# FIXME can we do migrations?
|
||||||
|
yesno:
|
||||||
|
<Return>: prompt-accept
|
||||||
|
y: prompt-accept yes
|
||||||
|
n: prompt-accept no
|
||||||
|
<Alt-Y>: prompt-yank
|
||||||
|
<Alt-Shift-Y>: prompt-yank --sel
|
||||||
|
<Escape>: leave-mode
|
||||||
caret:
|
caret:
|
||||||
v: toggle-selection
|
v: toggle-selection
|
||||||
<Space>: toggle-selection
|
<Space>: toggle-selection
|
||||||
@ -2438,7 +2444,7 @@ bindings.default:
|
|||||||
none_ok: true
|
none_ok: true
|
||||||
keytype: String # section name
|
keytype: String # section name
|
||||||
fixed_keys: ['normal', 'insert', 'hint', 'passthrough', 'command',
|
fixed_keys: ['normal', 'insert', 'hint', 'passthrough', 'command',
|
||||||
'prompt', 'caret', 'register']
|
'prompt', 'yesno', 'caret', 'register']
|
||||||
valtype:
|
valtype:
|
||||||
name: Dict
|
name: Dict
|
||||||
none_ok: true
|
none_ok: true
|
||||||
@ -2462,7 +2468,7 @@ bindings.commands:
|
|||||||
none_ok: true
|
none_ok: true
|
||||||
keytype: String # section name
|
keytype: String # section name
|
||||||
fixed_keys: ['normal', 'insert', 'hint', 'passthrough', 'command',
|
fixed_keys: ['normal', 'insert', 'hint', 'passthrough', 'command',
|
||||||
'prompt', 'caret', 'register']
|
'prompt', 'yesno', 'caret', 'register']
|
||||||
valtype:
|
valtype:
|
||||||
name: Dict
|
name: Dict
|
||||||
none_ok: true
|
none_ok: true
|
||||||
@ -2534,10 +2540,8 @@ bindings.commands:
|
|||||||
|
|
||||||
* prompt: Entered when there's a prompt to display, like for download
|
* prompt: Entered when there's a prompt to display, like for download
|
||||||
locations or when invoked from JavaScript.
|
locations or when invoked from JavaScript.
|
||||||
+
|
|
||||||
You can bind normal keys in this mode, but they will be only active when
|
* yesno: Entered when there's a yes/no prompt displayed.
|
||||||
a yes/no-prompt is asked. For other prompt modes, you can only bind
|
|
||||||
special keys.
|
|
||||||
|
|
||||||
* caret: Entered when pressing the `v` mode, used to select text using the
|
* caret: Entered when pressing the `v` mode, used to select text using the
|
||||||
keyboard.
|
keyboard.
|
||||||
|
@ -133,9 +133,7 @@ class PromptKeyParser(keyparser.CommandKeyParser):
|
|||||||
def __init__(self, win_id, parent=None):
|
def __init__(self, win_id, parent=None):
|
||||||
super().__init__(win_id, parent, supports_count=False,
|
super().__init__(win_id, parent, supports_count=False,
|
||||||
supports_chains=True)
|
supports_chains=True)
|
||||||
# We don't want an extra section for this in the config, so we just
|
self._read_config('yesno')
|
||||||
# abuse the prompt section.
|
|
||||||
self._read_config('prompt')
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return utils.get_repr(self)
|
return utils.get_repr(self)
|
||||||
|
@ -507,8 +507,8 @@ class _BasePrompt(QWidget):
|
|||||||
self._key_grid = QGridLayout()
|
self._key_grid = QGridLayout()
|
||||||
self._key_grid.setVerticalSpacing(0)
|
self._key_grid.setVerticalSpacing(0)
|
||||||
|
|
||||||
# The bindings are all in the 'prompt' mode, even for yesno prompts
|
all_bindings = config.key_instance.get_reverse_bindings_for(
|
||||||
all_bindings = config.key_instance.get_reverse_bindings_for('prompt')
|
self.KEY_MODE.name)
|
||||||
labels = []
|
labels = []
|
||||||
|
|
||||||
for cmd, text in self._allowed_commands():
|
for cmd, text in self._allowed_commands():
|
||||||
|
Loading…
Reference in New Issue
Block a user