Add keybindings for Ctrl-?/H/J/[ for Delete/Backspace/Return/Escape
This commit is contained in:
parent
361dc94a21
commit
500ad24cc3
@ -685,6 +685,7 @@ DATA = OrderedDict([
|
||||
('<Escape>', 'leave-mode'),
|
||||
('<Ctrl-N>', 'leave-mode'),
|
||||
('<Ctrl-E>', 'open-editor'),
|
||||
('<Ctrl-[>', '${<Escape>}'),
|
||||
)),
|
||||
|
||||
('keybind.hint', sect.ValueList(
|
||||
@ -692,11 +693,13 @@ DATA = OrderedDict([
|
||||
('<Return>', 'follow-hint'),
|
||||
('<Escape>', 'leave-mode'),
|
||||
('<Ctrl-N>', 'leave-mode'),
|
||||
('<Ctrl-[>', '${<Escape>}'),
|
||||
)),
|
||||
|
||||
('keybind.passthrough', sect.ValueList(
|
||||
types.KeyBindingName(), types.KeyBinding(),
|
||||
('<Escape>', 'leave-mode'),
|
||||
('<Ctrl-[>', '${<Escape>}'),
|
||||
)),
|
||||
|
||||
# FIXME we should probably have a common section for input modes with a
|
||||
@ -723,6 +726,10 @@ DATA = OrderedDict([
|
||||
('<Alt-D>', 'rl-kill-word'),
|
||||
('<Ctrl-W>', 'rl-unix-word-rubout'),
|
||||
('<Ctrl-Y>', 'rl-yank'),
|
||||
('<Ctrl-?>', 'rl-delete-char'),
|
||||
('<Ctrl-H>', 'rl-backward-delete-char'),
|
||||
('<Ctrl-J>', '${<Return>}'),
|
||||
('<Ctrl-[>', '${<Escape>}'),
|
||||
)),
|
||||
|
||||
('keybind.prompt', sect.ValueList(
|
||||
@ -742,6 +749,10 @@ DATA = OrderedDict([
|
||||
('<Alt-D>', 'rl-kill-word'),
|
||||
('<Ctrl-W>', 'rl-unix-word-rubout'),
|
||||
('<Ctrl-Y>', 'rl-yank'),
|
||||
('<Ctrl-?>', 'rl-delete-char'),
|
||||
('<Ctrl-H>', 'rl-backward-delete-char'),
|
||||
('<Ctrl-J>', '${<Return>}'),
|
||||
('<Ctrl-[>', '${<Escape>}'),
|
||||
)),
|
||||
|
||||
('aliases', sect.ValueList(
|
||||
|
@ -92,6 +92,14 @@ class ReadlineBridgeTest(TestCase):
|
||||
self.bridge.rl_end_of_line()
|
||||
self.qle.end.assert_called_with(False)
|
||||
|
||||
def test_rl_delete_char(self):
|
||||
self.bridge.rl_delete_char()
|
||||
self.qle.del_.assert_called_with()
|
||||
|
||||
def test_rl_backward_delete_char(self):
|
||||
self.bridge.rl_backward_delete_char()
|
||||
self.qle.backspace.assert_called_with()
|
||||
|
||||
def test_rl_unix_line_discard(self):
|
||||
"""Set a selected text, delete it, see if it comes back with yank."""
|
||||
self._set_selected_text("delete test")
|
||||
|
@ -126,3 +126,17 @@ class ReadlineBridge:
|
||||
if self.widget is None or self.widget not in self.deleted:
|
||||
return
|
||||
self.widget.insert(self.deleted[self.widget])
|
||||
|
||||
@cmd.register(instance='rl_bridge', hide=True, modes=['command', 'prompt'])
|
||||
def rl_delete_char(self):
|
||||
"""Readline: Delete the character at point."""
|
||||
if self.widget is None:
|
||||
return
|
||||
self.widget.del_()
|
||||
|
||||
@cmd.register(instance='rl_bridge', hide=True, modes=['command', 'prompt'])
|
||||
def rl_backward_delete_char(self):
|
||||
"""Readline: Delete the character behind the cursor."""
|
||||
if self.widget is None:
|
||||
return
|
||||
self.widget.backspace()
|
||||
|
Loading…
Reference in New Issue
Block a user