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

Reply via email to