Mouse events show up as characters in the terminal instead of being handled
What Operating System(s) are you seeing this problem on?
macOS
Which Wayland compositor or X11 Window manager(s) are you using?
No response
WezTerm version
wezterm 20240203-110809-5046fc22
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
No, and I'll explain why below
Describe the bug
I have been noticing this bug for a while. I have long running ssh sessions (using regular ssh, not the one integrated in wezterm) when I'm at work. Then, I close my laptop, and head to the train station. When I board the train, I open the laptop and it tethers with my phone. Naturally, this causes the ssh connection to break, so I redo ssh to the same host. This is when the issue start.
If I try to scroll up/down via the trackpad on Mac (two finger scroll) instead of scrolling, the current line fills with symbols like:
`B`B`BBaBaBa
The worst is, I can't even select the text with the mouse (as I'm used to), as that just emits:
U#U
To Reproduce
No response
Configuration
My config is here: https://github.com/knl/dotskel/tree/main/configs/wezterm/config
Expected Behavior
No response
Logs
17:37:23.682 ERROR termwiz::escape::parser > impossible C0/C1 control code '\u{80}' 0x80 was dropped 17:37:23.876 ERROR termwiz::escape::parser > impossible C0/C1 control code '\u{80}' 0x80 was dropped 17:39:44.455 WARN wezterm_gui::tabbar > format-tab-title: runtime error: ...rs/nknezevi1/.config/wezterm/events/format-tab-title.lua:63: attempt to index a nil value (global 'wezterm') stack traceback: [C]: in metamethod 'index' ...rs/nknezevi1/.config/wezterm/events/format-tab-title.lua:63: in function <...rs/nknezevi1/.config/wezterm/events/format-tab-title.lua:9>
Anything else?
No response
This is how it looks like. I don't even need to be ssh'd or ssh again, just wake my computer from sleep and start moving mouse to scroll in a terminated ssh session, where during the sleep I changed the network.
Mouse events remain on until turned off by the application. You can use the command palette to reset the terminal emulator state to recover from this. It is not a bug in wezterm; the same would apply to any terminal.
@wez can you elaborate on command palette to reset the terminal emulator ?
I tried Esc c from https://wezfurlong.org/wezterm/config/lua/keyassignment/ResetTerminal.html but no luck
I also have issue with mouse events generating characters sometimes, maybe after mac goes to sleep. And yes, I had same issues sometimes in iTerm. It disappears on new tab.
https://github.com/user-attachments/assets/de65ce93-c69b-4d55-af02-c9d0685836b2
My wezterm config - https://github.com/tot-ra/workstation/blob/main/.config/wezterm/wezterm.lua
Running reset command helps
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.