On Fri, Jun 26, 2026 at 12:15:49AM -0400, Kurt Hackenberg wrote:
On Thu, Jun 25, 2026 at 18:30 +0800, Kevin J. McCarthy wrote:

Ah, I figured out what foot is doing with meta enabled, (and xterm without any metaSendsEscape settings).

If I type Alt-p, the terminal converts 'p', 0x70, to 0xF0, by flipping the high bit. But then it encodes that in utf-8 and sends that to mutt. So mutt receives 0xC3 0xB0 in two getch() calls.

It's a mess.

That sounds like a bug in foot, or maybe a misconfiguration. It should do at most one of those things, not both.

xterm does the same thing, if you remove all its configuration settings and run it in a utf-8 locale: converting Alt-p to 0xF0 and then utf-8 encoding and sending that to mutt as two bytes. It seems xterm relies on the "xterm.vt100.metaSendsEscape: true" setting, which is ubiquitous, to do Esc prefixing. The presence of the meta() call doesn't affect xterm's behavior - it relies solely on the presence of that config to do the Esc-prefixing or not.

foot, on the other hand, does Esc-prefixing out of the box. It is affected by the meta() call though, which seems to switch foot into the same mode that xterm has by default. So I don't think that I have enough knowledge or any standing to suggest to foot they are doing the wrong thing. :") It's just a matter of how they've interpreted and implemented smm/rmm.

Anyway, I agree that it's probably best to remove Mutt's call to the ncurses function meta().

I'm actually pondering pushing this commit to stable and releasing it with 2.4.1. Feedback?

Ehh...maybe try foot again? It really shouldn't do what you describe above.

I appreciate the note of caution, but at this point, I think it's worth the risk. foot has an increasing user base, and the Debian bug(s) have been around for a year. I wish I'd heard about the problem earlier.

In addition to xterm and foot, I've also tested ghostty, alacritty, kitty, and gnome-terminal. Those last four seem unaffected by the change. If there are other terminals anyone can suggest (that don't involve too many dependencies) I'll be glad to try them out too.

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

Attachment: signature.asc
Description: PGP signature

Reply via email to