mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-119035: Add Ctrl+← and Ctrl+→ word-skipping keybindings to new repl (#119248)
add word-skipping ctrl keybindings to new repl
This commit is contained in:
parent
c4722cd057
commit
0398d93392
2 changed files with 8 additions and 3 deletions
|
@ -177,9 +177,12 @@ def _parse_key1(key, s):
|
|||
ret = key[s]
|
||||
s += 1
|
||||
if ctrl:
|
||||
if len(ret) > 1:
|
||||
raise KeySpecError("\\C- must be followed by a character")
|
||||
ret = chr(ord(ret) & 0x1F) # curses.ascii.ctrl()
|
||||
if len(ret) == 1:
|
||||
ret = chr(ord(ret) & 0x1F) # curses.ascii.ctrl()
|
||||
elif ret in {"left", "right"}:
|
||||
ret = f"ctrl {ret}"
|
||||
else:
|
||||
raise KeySpecError("\\C- followed by invalid key")
|
||||
if meta:
|
||||
ret = ["\033", ret]
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue