mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 19:41:15 -03:00
pexpect test for commandline --current-process
It was not clear to me hwo this behaves when there are comments. Include a friendly helper to compute control characters. No functional change.
This commit is contained in:
@@ -341,3 +341,25 @@ class SpawnedProc(object):
|
||||
"LIGHTCYAN": ansic(96),
|
||||
"WHITE": ansic(97),
|
||||
}
|
||||
|
||||
|
||||
def control(char: str) -> str:
|
||||
""" Returns the char sent when control is pressed along the given key. """
|
||||
assert len(char) == 1
|
||||
char = char.lower()
|
||||
if ord("a") <= ord(char) <= ord("z"):
|
||||
return chr(ord(char) - ord("a") + 1)
|
||||
return chr({
|
||||
"@": 0,
|
||||
"`": 0,
|
||||
"[": 27,
|
||||
"{": 27,
|
||||
"\\": 28,
|
||||
"|": 28,
|
||||
"]": 29,
|
||||
"}": 29,
|
||||
"^": 30,
|
||||
"~": 30,
|
||||
"_": 31,
|
||||
"?": 127,
|
||||
}[char])
|
||||
|
||||
Reference in New Issue
Block a user