[bug #67076] Backspace/Delete keys are messed up in terminal

Andrey <[email protected]> Sat, 3 May 2025 08:31:19 -0400 (EDT)
Newsgroups gmane.comp.boot-loaders.grub.bugs
Message-ID <[email protected]>
URL:
  <https://savannah.gnu.org/bugs/?67076>

                 Summary: Backspace/Delete keys are messed up in terminal
                   Group: GNU GRUB
               Submitter: bam80
               Submitted: Сб 03 мая 2025 12:31:11
                Category: Terminal
                Severity: Major
                Priority: 5 - Normal
              Item Group: Software Error
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
                 Release: Git master
                 Release:
         Reproducibility: Every Time
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Сб 03 мая 2025 12:31:11   By: Andrey <bam80>
In all nowadays terminal emulators (VTE-based, XTerm, Linux console, etc.)
with "standard" settings, Backspace/Delete keys are messed up in Grub:
Backspace key behaves as Delete (erases symbol under cursor) and Delete
behaves as Escape (cancels editing screen to menu).

From [https://www.gnu.org/software/grub/manual/grub/grub.html#terminfo
terminfo] command description:
> The currently available terminal types are ‘vt100’, ‘vt100-color’,
> ‘ieee1275’, and ‘dumb’. If you need other terminal types, please
> contact us to discuss the best way to include support for these in GRUB.

As a possible solution, please consider adding a VT220 and/or VT420 support.
These more recent VT* variants have  _kdch1_=\E[3~ ("delete-one-char" key)
terminfo capability, which corresponds to a modern emulators behavior:

From [https://invisible-island.net/xterm/xterm.html#history XTerm history]:
> The preferred terminal description for xterm has evolved over time, so that
> programs can use more advanced features:
> * For the first ten years of xterm's history (until 1996), the preferred
> terminal description was based on the VT102.
> * The following eighteen years (until 2012) preferred a description based on
> VT220.
> ** Since 2012, the preferred description is based on VT420.*

Note VT100 doesn't have _kdch1_ capability at all, thus is the problem:

$ infocmp -d vt100 vt220 
comparing vt100 to vt220.
    comparing booleans.
	mir: F:T.
    comparing numbers.
    comparing strings.
	blink: '\E[5m$<2>', '\E[5m'.
	bold: '\E[1m$<2>', '\E[1m'.
	civis: NULL, '\E[?25l'.
	clear: '\E[H\E[J$<50>', '\E[H\E[J'.
	cnorm: NULL, '\E[?25h'.
	cuf1: '\E[C$<2>', '\E[C'.
	cup: '\E[%i%p1%d;%p2%dH$<5>', '\E[%i%p1%d;%p2%dH'.
	cuu1: '\E[A$<2>', '\E[A'.
	dch: NULL, '\E[%p1%dP'.
	dch1: NULL, '\E[P'.
	dl: NULL, '\E[%p1%dM'.
	dl1: NULL, '\E[M'.
	ech: NULL, '\E[%p1%dX'.
	ed: '\E[J$<50>', '\E[J'.
	el: '\E[K$<3>', '\E[K'.
	el1: '\E[1K$<3>', '\E[1K'.
	enacs: '\E(B\E)0', '\E)0'.
	flash: NULL, '\E[?5h$<200/>\E[?5l'.
	ich: NULL, '\E[%p1%d@'.
	if: NULL, '/usr/share/tabset/vt100'.
	il: NULL, '\E[%p1%dL'.
	il1: NULL, '\E[L'.
	ind: '\n', '\ED'.
	is2: NULL, '\E[?7h\E[>\E[?1l\E F\E[?4l'.
	ka1: '\EOq', NULL.
	ka3: '\EOs', NULL.
	kb2: '\EOr', NULL.
	kc1: '\EOp', NULL.
	kc3: '\EOn', NULL.
	kcub1: '\EOD', '\E[D'.
	kcud1: '\EOB', '\E[B'.
	kcuf1: '\EOC', '\E[C'.
	kcuu1: '\EOA', '\E[A'.
	kdch1: NULL, '\E[3~'.
	kent: '\EOM', NULL.
	kf0: '\EOy', NULL.
	kf10: '\EOx', '\E[21~'.
	kf11: NULL, '\E[23~'.
	kf12: NULL, '\E[24~'.
	kf13: NULL, '\E[25~'.
	kf14: NULL, '\E[26~'.
	kf17: NULL, '\E[31~'.
	kf18: NULL, '\E[32~'.
	kf19: NULL, '\E[33~'.
	kf20: NULL, '\E[34~'.
	kf5: '\EOt', NULL.
	kf6: '\EOu', '\E[17~'.
	kf7: '\EOv', '\E[18~'.
	kf8: '\EOl', '\E[19~'.
	kf9: '\EOw', '\E[20~'.
	kfnd: NULL, '\E[1~'.
	khlp: NULL, '\E[28~'.
	kich1: NULL, '\E[2~'.
	knp: NULL, '\E[6~'.
	kpp: NULL, '\E[5~'.
	krdo: NULL, '\E[29~'.
	kslt: NULL, '\E[4~'.
	mc0: '\E[0i', '\E[i'.
	nel: NULL, '\EE'.
	rev: '\E[7m$<2>', '\E[7m'.
	ri: '\EM$<5>', '\EM'.
	rmacs: '^O', '\E(B$<4>'.
	rmir: NULL, '\E[4l'.
	rmkx: '\E[?1l\E>', NULL.
	rmso: '\E[m$<2>', '\E[27m'.
	rmul: '\E[m$<2>', '\E[24m'.
	rs1: NULL, '\E[?3l'.
	rs2: '\E<\E>\E[?3;4;5l\E[?7;8h\E[r', NULL.
	sgr:
'\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>',
'\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>'.
	sgr0: '\E[m\017$<2>', '\E[m\E(B'.
	smacs: '^N', '\E(0$<2>'.
	smir: NULL, '\E[4h'.
	smkx: '\E[?1h\E=', NULL.
	smso: '\E[7m$<2>', '\E[7m'.
	smul: '\E[4m$<2>', '\E[4m'.
	u9: '\EZ', '\E[c'.









    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67076>

_______________________________________________
Сообщение отправлено по Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaBYMlwAKCRCqLAuaBUf3
To59AP4mtXxDPyH+Ltg0tGNKOpk3QfTU2SjKBB2U4OeS2whqiAD9HrcEC+i5aWmY
mgAXp5+SARbFUiHwKvSwIeo1CbJgcgM=
=+Mk/
-----END PGP SIGNATURE-----