##// END OF EJS Templates
PR: Unassigned allowed commands (#14564)...
PR: Unassigned allowed commands (#14564) From git git: > Modify binding mechanism to allow binding to one of a set of whitelisted commands, Add five such commands ("beginning_of_buffer", "end_of_buffer", "end_of_line", "forward_word", "unix_line_discard"). Currently, only commands which are assigned by default are allowed to be reassigned: ```python known_commands = { create_identifier(binding.command): binding.command for binding in KEY_BINDINGS } ... if command_id not in known_commands: ... raise ValueError( f"{command_id} is not a known shortcut command." f" Allowed commands are: \n - {allowed_commands}" ) ``` This PR adds a List UNASSIGNED_ALLOWED_COMMANDS and updates `known_commands` (now renamed to be more clear as `allowed_commands`): ```python allowed_commands.update({ create_identifier(command): command for command in UNASSIGNED_ALLOWED_COMMANDS }) ``` The five unassigned allowed commands are: ```python UNASSIGNED_ALLOWED_COMMANDS = [ nc.beginning_of_buffer, nc.end_of_buffer, nc.end_of_line, nc.forward_word, nc.unix_line_discard, ] ``` Motivation tldr: Until now, it is not possible to bind eg the common keybindng `ctrl+e` to prompt_toolkit's `end_of_line` (because it is not bound by default). Full motivation: https://github.com/ipython/ipython/issues/14369
M Bussonnier -
r28945:08be4c99 merge
Show More
Name Size Modified Last Commit Author
/ IPython / terminal
pt_inputhooks
shortcuts
tests
__init__.py Loading ...
console.py Loading ...
debugger.py Loading ...
embed.py Loading ...
interactiveshell.py Loading ...
ipapp.py Loading ...
magics.py Loading ...
prompts.py Loading ...
ptutils.py Loading ...