]> git.dujemihanovic.xyz Git - u-boot.git/commit
cli: Consume invalid escape sequences early
authorYurii Monakov <monakov.y@gmail.com>
Tue, 10 Oct 2023 08:16:39 +0000 (11:16 +0300)
committerTom Rini <trini@konsulko.com>
Tue, 24 Oct 2023 20:34:45 +0000 (16:34 -0400)
commit2dd86b9075466550685daea56ba2f28cb7d0b6a1
tree30e6e04f7e753ea3801387a96f47932e8681ceaf
parent5cab3515f8c9796015739c1750b8933291c816be
cli: Consume invalid escape sequences early

Unexpected 'Esc' key presses are accumulated internally, even if it is
already clear that the current escape sequence is invalid. This results
in weird behaviour. For example, the next character after 'Esc' key
simply disappears from input and 'Unknown command' is printed
after 'Enter'.

This commit fixes some issues with extra 'Esc' keys entered by user:

1. Sequence <Esc><Esc><Enter> right after autoboot stop gives:
=>
nknown command 'ry 'help'
=>
2. Sequence <Esc><p><r><i><Enter> gives:
=> ri
Unknown command 'ri' - try 'help'
=>
3. Extra 'Esc' key presses break backspace functionality.

Signed-off-by: Yurii Monakov <monakov.y@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/cli_getch.c
test/common/cread.c