mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 21:03:12 +00:00
357eb3cd32
byte_to_symbol was broken because it didn't iterate by byte, it
iterated by rust-char, which is a codepoint.
So it failed for everything outside of ascii and, because of a
mistaken bound, ascii chars from 0x21 to 0x2F ("!" to "/" - all the punctuation).
char_to_symbol will print printable codepoints as-is and
others escaped. This is okay - something like `decoded from: +` or
`decoded from: ö` is entirely understandable, there is no need to tell
you that "ö" is \xc3\xb6.
This reverts commit 423e5f6c03
.
66 lines
1.6 KiB
Python
66 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
from pexpect_helper import SpawnedProc
|
|
import subprocess
|
|
import sys
|
|
from time import sleep
|
|
import os
|
|
|
|
os.environ["fish_escape_delay_ms"] = "10"
|
|
SpawnedProc()
|
|
sp = SpawnedProc()
|
|
send, sendline, sleep, expect_prompt, expect_re, expect_str = (
|
|
sp.send,
|
|
sp.sendline,
|
|
sp.sleep,
|
|
sp.expect_prompt,
|
|
sp.expect_re,
|
|
sp.expect_str,
|
|
)
|
|
expect_prompt()
|
|
|
|
sendline("$fish_key_reader --version")
|
|
expect_re("fish_key_reader, version .*")
|
|
expect_prompt()
|
|
|
|
sendline("exec $fish_key_reader -c -V")
|
|
|
|
# Do we get the expected startup prompt?
|
|
expect_str("Press a key:")
|
|
|
|
# Is a single control char echoed correctly?
|
|
send("\x07")
|
|
expect_str("# decoded from: \\x07\r\n")
|
|
expect_str("bind ctrl-g 'do something'\r\n")
|
|
|
|
# Is a non-ASCII UTF-8 sequence prefaced by an escape char handled correctly?
|
|
sleep(0.020)
|
|
send("\x1B")
|
|
expect_str("# decoded from: \\e\r\n")
|
|
expect_str("bind escape 'do something'\r\n")
|
|
send("ö")
|
|
expect_str("# decoded from: ö\r\n")
|
|
expect_str("bind ö 'do something'\r\n")
|
|
send("\u1234")
|
|
expect_str("bind ሴ 'do something'\r\n")
|
|
|
|
# Is a NULL char echoed correctly?
|
|
sleep(0.020)
|
|
send("\x00")
|
|
expect_str("bind ctrl-space 'do something'\r\n")
|
|
|
|
send("\x1b\x7f")
|
|
expect_str("# decoded from: \\e\\x7f\r\n")
|
|
expect_str("bind alt-backspace 'do something'\r\n")
|
|
|
|
send("\x1c")
|
|
expect_str(r"bind ctrl-\\ 'do something'")
|
|
|
|
# Does it keep running if handed control sequences in the wrong order?
|
|
send("\x03")
|
|
sleep(0.010)
|
|
send("\x04")
|
|
|
|
# Now send a second ctrl-d. Does that terminate the process like it should?
|
|
sleep(0.050)
|
|
send("\x04\x04")
|
|
expect_str("Exiting at your request.\r\n")
|