[PATCH v3] cli: Consume invalid escape sequences early

Rasmus Villemoes rasmus.villemoes at prevas.dk
Wed Oct 25 10:31:43 CEST 2023


On 10/10/2023 10.16, Yurii Monakov wrote:
> 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.

Thank you! This has been bugging me for years, since we have

CONFIG_AUTOBOOT_DELAY_STR=" "
CONFIG_AUTOBOOT_STOP_STR="\x1b"

and pressing <esc> to stop autoboot did have that side-effect of
swallowing the first following char. But I never found the time to dig
into why or if it was even fixable.

Tom has already applied this, but nevertheless

Tested-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>

Rasmus



More information about the U-Boot mailing list