Hello! 👋 This is based on an issue that was reported to me over in Ghostty.
XTGETTCAP for ht ("^I"):
- xterm:
09
- foot:
5E49
- kitty:
5E49
Note, I had to patch xterm to support ht but you can use kbs if you want a built-in xterm terminfo value that uses this format. But kbs for xterm is ^H and for foot its ^? so don't expect them to match, but you can see the encoding happening.[1]
The logic in Foot seems to be that for parameterized strings, they are returned in terminfo source format (matching Kitty). But for non-parameterized strings, they are returned in termcap encoded format (i.e. \E is replaced with 0x1B). termcap encoded format should also process control characters such as ^H and xterm behavior seems to match this, but foot does not.
Note that termcap encoding is way more complicated and at least for my terminal I've opted to say "fuck that" and only handle the encodings that I actually use. So, there are still encodings that we're all probably still wrong on but they don't matter in practice because our terminfo doesn't have them.
Ghostty used to also do 5E49 but I've now fixed this to match xterm to process control characters to 09.
As a disclaimer, I may be missing some detail about XTGETTCAP that makes this behavior wrong, but in my studying of ncurses, xterm, and foot+kitty this is the conclusion I came to. Please correct me if I'm wrong.
[1]: Separate to this issue, why is foot's terminfo ^? for kbs? Shouldn't this be ^H?
Hello! 👋 This is based on an issue that was reported to me over in Ghostty.
`XTGETTCAP` for `ht` ("^I"):
* xterm: `09`
* foot: `5E49`
* kitty: `5E49`
Note, I had to patch xterm to support `ht` but you can use `kbs` if you want a built-in xterm terminfo value that uses this format. But `kbs` for xterm is `^H` and for foot its `^?` so don't expect them to match, but you can see the encoding happening.[1]
The logic in Foot seems to be that for parameterized strings, they are returned in terminfo source format (matching Kitty). But for non-parameterized strings, they are returned in termcap encoded format (i.e. `\E` is replaced with 0x1B). termcap encoded format should also process control characters such as `^H` and xterm behavior seems to match this, but foot does not.
Note that termcap encoding is [way more complicated](https://github.com/mirror/ncurses/blob/master/ncurses/tinfo/captoinfo.c#L619) and at least for my terminal I've opted to say "fuck that" and only handle the encodings that I actually use. So, there are still encodings that we're all probably still wrong on but they don't matter in practice because our terminfo doesn't have them.
Ghostty used to also do `5E49` but I've now fixed this to match xterm to process control characters to `09`.
As a disclaimer, I may be missing some detail about XTGETTCAP that makes this behavior wrong, but in my studying of ncurses, xterm, and foot+kitty this is the conclusion I came to. Please correct me if I'm wrong.
[1]: Separate to this issue, why is foot's terminfo `^?` for `kbs`? Shouldn't this be `^H`?