Another what the heck moment in Fedora 43. In Gnome-terminal (only, not xterm), hitting 'Delete' in vim insert mode no longer deletes characters to the left of the cursor, only characters to the right. Delete is generating ^? in both gnome-terminal and xterm, and Delete works to delete characters in vim in g-t on the ':' command prompt.

Whatever vim / gnome-terminal combined stupidity this is, I want it gone. Now.

Well I have an answer to my vim and gnome-terminal thing and the answer is 'set noxtermcodes'. The other answer is that both gnome-terminal and vim have what I think are bugs that collude to allow this situation to happen. You can argue about exactly whose fault this was, but that's not really productive.

Well I guess there is a workaround in gnome-terminal by changing what it generates for 'Delete' (the key) to 'escape sequence'. What a mess.

@cks shouldn’t backspace send ^H and delete send ^?

what does stty say about the keys / characters?

@drscriptt @cks

The terminal line discipline has very little to do with it, as full-screen programs like VIM put the line discipline into non-canonical mode, where there are no special characters.

Where this issue lies, and has done since the 1980s, is emulating a DEC VT.

On an actual DEC VT the Backspace key is programmatically switchable between DEL and BS. #XTerm extended this years ago and makes the two Delete keys switchable between DEL and DECFNK 3.

#DECVTs #TerminalEmulators

@JdeBP @drscriptt TIL that the physical key was switchable instead of always generating DEL, which is what I'd absorbed.

(Switchable was useful because on other physical terminals the Backspace key generated ^H, so you might have software and setups that assumed that, then you got some DEC VTs and ...)

@cks @drscriptt

By the way: It's DEC Private Mode 67 (a.k.a. DECBKM) for controlling Backspace, and DEC Private Mode 1037 for Delete.

Not every terminal emulator understands these. But they're understood by things as wide ranging as hterm and mintty.

I copied these from #DECVTs and XTerm in my terminal emulator, and my #setterm has options for generating both DECSM/DECRM mode switches.

http://jdebp.info/Softwares/nosh/guide/commands/setterm.xml

#nosh #TerminalEmulators