fish_key_reader: Only name keys if they match the entire sequence

This would misname `\e\x7F` as "backspace":

bind -k backspace 'do something'
bind \e\x7F 'do something'

because it would check if there was any key *in there*.

This was probably meant for continuous mode, but it simply doesn't
work right. It's preferable to not give a key when one would work over
giving one when it's not correct.
This commit is contained in:
Fabian Boehm
2024-01-02 17:20:42 +01:00
parent 744fa72d9c
commit 5a77db8353
2 changed files with 11 additions and 7 deletions

View File

@@ -38,6 +38,13 @@ sleep(0.020)
send("\x00")
expect_str("char: \\c@\r\nbind -k nul 'do something'\r\n")
# Ensure we only name the sequence if we match all of it.
# Otherwise we end up calling escape+backspace "backspace"!
send("\x1b\x7f")
expect_str('char: \\e\r\n')
expect_str('char: \\x7F')
expect_str('''(aka "del")\r\nbind \\e\\x7F 'do something'\r\n''')
# Does it keep running if handed control sequences in the wrong order?
send("\x03")
sleep(0.010)