Bug#1113796: mutt: key bindings involving meta (esc) do not work on foot

2026-07-05 Thread Nikolas Nyby
This was fixed in mutt version 2.4.1:

  https://gitlab.com/muttmua/mutt/raw/stable/UPDATING



Bug#1113796: mutt: key bindings involving meta (esc) do not work on foot

2026-05-12 Thread Helmut Grohne
On Mon, Sep 01, 2025 at 08:31:09AM +0200, Helmut Grohne wrote:
> I am observing an annoying oddity when using mutt inside foot. By 
> default, foot causes meta ("alt" key) to send a ESC (0x1b) as a prefix. 
> This is what xterm calls metaSendsEscape (see manual page of foot for 
> details) and as far as I can see, this is also what mutt expects. The 
> behavior of the meta key can be changed at runtime using the escape 
> sequences named "smm" and "rmm" in the terminfo database. Consider the 
> following interaction in both an xterm and a foot terminal:
>  * Start the terminal (expecting a bash shell).
>  * Press meta-1.
>+ Both: This invokes a readline behavior and looks like "(arg: 1)".
>  * Press ctrl-c to abort.
>  * Start mutt.
>  * Use a key binding that involves meta. Example meta-l to show the 
>current limit.
>+ xterm: "No limit pattern is in effect."
>+ foot: "Key is not bound.  Press '?' for help."
>  * Exit mutt.
>  * Press meta-1.
>+ xterm: "(arg: 1)"
>+ foot: "±"
>  * On foot, we may restore the meta behavior using printf "\e[?1036h" 
>(first half of rmm) or by resetting the terminal.
> 
> What we can see here is that mutt somehow invokes smm and thus disables 
> the sending of meta keys for sending escape, but it does not expect that 
> behavior. It also does not restore the behavior on exit.
> 
> We can further verify this by running mutt in strace and observing what 
> it writes to stdout. Right after parsing /etc/Muttrc it goes:
> 
> write(1, "\33[?1036l\33[?1034h\33[39;49m\33[37m\33[40m\33[H\33[2J", 41) = 41
> 
> That \33[?1036l is what disables the sending of esc. However, I could 
> not locate any relevant "smm", "rmm" or "1036l" in the mutt source code 
> that would be causing this. Ultimately, I may be looking at the wrong 
> layer.
> 
> I appreciate if someone knows a workaround for the issue. What works is 
> pressing the actual escape key (e.g. esc then l instead of meta-l). In 
> any case, this is not working as intended.

Timo Roehling helped me track this down. The ncurses function that
controls rmm/smm is called "meta". As it happens, mutt calls

meta (stdscr, TRUE);

in its main.c. According to the ncurses documentation, the TRUE
parameter causes smm to be sent. According to infocmp, smm corresponds
to \E[?1036l\E[?103. According to the foot manual page, this disables
meta-sends-escape. This is exactly, the behavior I am observing.

I also found the meta_key option in the muttrc manual. It defaults to
no. Setting it to yes would be supposed to meta meta interpretation work
when it is set to eight-bit. Practically, I cannot confirm that this
works as expected.

Can we make mutt not fiddle with the smm/rmm settings? Alternatively,
can we make this feature opt-out via some muttrc option?

Helmut



Bug#1113796: mutt: key bindings involving meta (esc) do not work on foot

2025-09-03 Thread Helmut Grohne
Package: mutt
Version: 2.2.13-1
Control: affects -1 + foot
X-Debbugs-Cc: [email protected]

Hi,

I am observing an annoying oddity when using mutt inside foot. By 
default, foot causes meta ("alt" key) to send a ESC (0x1b) as a prefix. 
This is what xterm calls metaSendsEscape (see manual page of foot for 
details) and as far as I can see, this is also what mutt expects. The 
behavior of the meta key can be changed at runtime using the escape 
sequences named "smm" and "rmm" in the terminfo database. Consider the 
following interaction in both an xterm and a foot terminal:
 * Start the terminal (expecting a bash shell).
 * Press meta-1.
   + Both: This invokes a readline behavior and looks like "(arg: 1)".
 * Press ctrl-c to abort.
 * Start mutt.
 * Use a key binding that involves meta. Example meta-l to show the 
   current limit.
   + xterm: "No limit pattern is in effect."
   + foot: "Key is not bound.  Press '?' for help."
 * Exit mutt.
 * Press meta-1.
   + xterm: "(arg: 1)"
   + foot: "±"
 * On foot, we may restore the meta behavior using printf "\e[?1036h" 
   (first half of rmm) or by resetting the terminal.

What we can see here is that mutt somehow invokes smm and thus disables 
the sending of meta keys for sending escape, but it does not expect that 
behavior. It also does not restore the behavior on exit.

We can further verify this by running mutt in strace and observing what 
it writes to stdout. Right after parsing /etc/Muttrc it goes:

write(1, "\33[?1036l\33[?1034h\33[39;49m\33[37m\33[40m\33[H\33[2J", 41) = 41

That \33[?1036l is what disables the sending of esc. However, I could 
not locate any relevant "smm", "rmm" or "1036l" in the mutt source code 
that would be causing this. Ultimately, I may be looking at the wrong 
layer.

I appreciate if someone knows a workaround for the issue. What works is 
pressing the actual escape key (e.g. esc then l instead of meta-l). In 
any case, this is not working as intended.

Helmut