crigler / dtach

A simple program that emulates the detach feature of screen
GNU General Public License v2.0
476 stars 50 forks source link

up/down arrow keys stop working after reconnect to dtach process with mosh #14

Open simonmichael opened 6 years ago

simonmichael commented 6 years ago

Thank you for dtach, I love it. https://github.com/mobile-shell/mosh/issues/980 says the above is a dtach issue. Would you agree/have any ideas for a solution ? I forgot to mention that pressing the escape key once before each arrow key press seems to work around this somehow, allowing movement.

crigler commented 6 years ago

It looks like mosh is setting the TERM environment variable differently than ssh. See mobile-shell/mosh#728 and mobile-shell/mosh#446.

htop may also be sending the initialization string defined for the current $TERM on startup, which can set the terminal into a different mode. Not all terminal types have an initialization string, though, and dtach will not resend the initialization string when reattaching (and not all programs use the initialization string on startup.) See https://www.tldp.org/HOWTO/Text-Terminal-HOWTO-16.html#ss16.5

You may be able to work around this and get mosh+dtach+htop to work by changing TERM to match what ssh is using before starting htop, or by using a command to resend the initialization string before telling dtach to re-attach to htop.