The same applies not just for the mouse mode, but a whole lot of other
terminal modes (e.g. keypad modes, alternate charset, alternate scroll
mode, bracketed paste mode, colors, attributes and many many more...).

The problem cannot be fixed in the terminal: The terminal, by design,
only sees a single continuous stream of instructions to execute. It has
no idea where they come from, e.g. remote or local, ssh or not. It
cannot figure out when is the time to override those instructions.

A reasonable place to fix this would be the shell prompt (or a hardwired
behavior of the shell, to reset these modes whenever it prints the
prompt). You can customize your PS1 to include the escape sequence that
switches off mouse mode, and whatever else you wish. (Don't forget to
wrap these in \[ \] as per the PROMPTING section in bash's manual.)

I agree that either upstream bash, or downstream distributions by
configuring PS1 accordingly, should do their best to minimalize the risk
of such situations, i.e. reset as many of the terminal modes as
reasonable. I myself used to do it in my personal PS1 until I got bored
of maintaining it and stopped caring, the problems are so rare that I
just execute "reset" or close the terminal and open a new one :)

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gnome-terminal in Ubuntu.
https://bugs.launchpad.net/bugs/1876768

Title:
  Terminal mouse went berserk after lost ssh connection

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1876768/+subscriptions

-- 
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to