Yup, I just wrote a csh script and got the same issue.
This has annoyed me for a while (on a variety of Slackware systems)
when I use grepm (which uses grepmail to search through some mail
boxes, in case anyone here doesn't know about it).
I notice that (in some cases, not all, maybe there is some race
condition) that the tty modes are incorrect when "fg" doesn't work
properly.
My tty modes when shell is waiting for a command (note I use ^X for
suspend, not ^Z):
speed 38400 baud; rows 57; columns 80; line = 0;
intr = ^C; quit = <undef>; erase = ^?; kill = ^U; eof = ^Z; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = <undef>;
rprnt = ^R; werase = ^W; lnext = <undef>; flush = <undef>; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint ignpar -parmrk -inpck -istrip inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
My tty modes when mutt is running:
speed 38400 baud; rows 57; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^Z; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^X; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff
-iuclc -ixany imaxbel iutf8
opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
and finally, my tty modes when when I did "fg" but got an incorrectly
restarted mutt:
speed 38400 baud; rows 57; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^Z; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^X; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
I wonder if mutt traps the SIGTSTP to restore the terminal modes, but
somehow the change of tty modes when starting back up this doesn't
always cooperate with the shell's setting of terminal modes (when mutt
is called from a shell script).
Any mutt maintainers / hackers listening? If so, any words of wisdom?
Cheers.
Jim