I discovered a little glitch in mutt 2.1.5: after sending mail, the up and down arrow keys stopped working (error message "key unbound" or similar). The normal keys still worked, so I used "q" to quit mutt, restarted it and everything was fine again.
My setup uses msmtp to send mails and I recently encrypted my smtp password with GnuPG 2, so every time I send mail pinentry-curses is invoked and prompts for the password to my gpg key. In sendlib.c line 2780 there is a comment that this use case should be supported by mutt: /* Some user's $sendmail command uses gpg for password decryption, * and is set up to prompt using ncurses pinentry. If we * mutt_endwin() it leaves other users staring at a blank screen. * So instead, just force a hard redraw on the next refresh. */ Then it calls the function mutt_need_hard_redraw() *before* sending the message with send_msg(). The redraw works because it is done on the next refresh after send_msg(). But mutt_need_hard_redraw() in curs_lib.c also includes a call to the curses function "keypad (stdscr, TRUE)". I suspect it to be necessary for working arrow keys in mutt. My speculation is that it has to come *after* pinentry-curses from send_msg() has reset the terminal to keep the arrow keys working in mutt. A test with the attached patch, moving mutt_need_hard_redraw() after send_msg(), was successful and the arrow keys were working again after sending mail. As I'm not a curses expert, I could be wrong and ask here if anyone can confirm or reject this reasoning. Maybe there is a better way to fix this issue. Robert
diff -urd mutt-2.1.5/sendlib.c mutt-2.1.5-patched/sendlib.c --- mutt-2.1.5/sendlib.c 2021-12-30 21:43:42.000000000 +0100 +++ mutt-2.1.5-patched/sendlib.c 2022-01-11 19:15:10.126437189 +0100 @@ -2777,6 +2777,8 @@ args[argslen++] = NULL; + i = send_msg (path, args, msg, option(OPTNOCURSES) ? NULL : &childout); + /* Some user's $sendmail command uses gpg for password decryption, * and is set up to prompt using ncurses pinentry. If we * mutt_endwin() it leaves other users staring at a blank screen. @@ -2784,7 +2786,7 @@ if (!option (OPTNOCURSES)) mutt_need_hard_redraw (); - if ((i = send_msg (path, args, msg, option(OPTNOCURSES) ? NULL : &childout)) != (EX_OK & 0xff)) + if (i != (EX_OK & 0xff)) { if (i != S_BKG) {