helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.63k stars 2.5k forks source link

Turning off mouse mode leaves terminal in a broken state #6638

Closed m-c-g closed 1 year ago

m-c-g commented 1 year ago

Summary

Setting mouse = false and reloading the config and then exiting breaks mouse handling in the terminal.

Clicking or moving the mouse after quitting sends codes to the command line. Removing the line from config and reloading will stop this behaviour but doesn't seem to fully restore the terminals mouse handling; text selection no longer works the way it should.

This is happening with Ubuntu running in VMFusion on a M1 mac using the Tilix terminal. I also checked this using the byobu terminal and saw the same behavior

This doesn't happen in MacOS running in the Warp terminal.

Could this be a problem with Helix or is it something with VMWare?

Reproduction Steps

I tried this: 1. `hx` I expected this to happen: Instead, this happened: ### Helix log
~/.cache/helix/helix.log ``` please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines ```
### Platform Linux on VMWare Fusion ### Terminal Emulator Tilix. Byobu ### Helix Version helix 23.03
the-mikedavis commented 1 year ago

Currently we look at the editor.mouse setting when claiming and restoring the terminal only (which happens when we start and exit Helix respectively). So I think what's happening here is that we start Helix with mouse support enabled, we tell the terminal emulator that we want to capture mouse inputs. Then if you reconfigure editor.mouse to false, we don't tell the terminal to disable mouse event capture. I can't reproduce this in Kitty or WezTerm so I think it may be Tilix specific. I'm guessing that most terminals disable mouse events when the running application exits raw mode. I think it should be possible to fix this by sending DisableMouseCapture or EnableMouseCapture when the config changes.