]> git.ipfire.org Git - thirdparty/util-linux.git/commit
agetty: fix erasure of escape sequences and tab characters
authorKarel Zak <kzak@redhat.com>
Wed, 17 Sep 2025 10:58:59 +0000 (12:58 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 17 Sep 2025 10:58:59 +0000 (12:58 +0200)
commitb462fdefe74836c22cb02039dca419a512dc6c88
treeebc3c082140cb6e6f6420059b7ca74ef9dd9f914
parent6bbf884525cad2702b1e69a0ac022db3ef92154d
agetty: fix erasure of escape sequences and tab characters

When escape sequences (like arrow keys) or tab characters are entered
at the login prompt, they are properly visualized but only partially
erasable with backspace. This is because the erase logic assumes each
stored character corresponds to one visual character, but escape
sequences display as "^[" (2 chars) and tabs expand to multiple spaces.

Track visual character width for each stored byte in a parallel array.
When erasing, use the stored visual width to properly erase all
displayed characters for that input byte.

Fixes: https://github.com/util-linux/util-linux/issues/3624
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/agetty.c