Mouse click and scroll event support for git-bash/mintty on Windows
The demo looks correct in git-bash on Windows, however it does not respond to mouse movement, click, and scroll events. It would be helpful to extend the existing drivers or driver selection to take this scenario into account. While the platform check will show "Windows", git-bash supports the event types in the Linux driver instead.
0;70;13M #left mouse button down 0;70;13m #left mouse button up
It's possible that a more nuanced environment check and loading the Linux driver in that case may enable it to work as expected.
We found the following entry in the FAQ which you may find helpful:
Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.
This is an automated reply, generated by FAQtory
I observed the same with git-bash under Windows 11 --- mouse actions have no effect in a Textual app. (I had to run a script using "winpty python ..." as directly running "python ..." hangs.) FWIW, "vim" with ":set mouse=a" enables the mouse successfully.
After some checking, it seems Textual never received any control sequence for mouse event. I haven't figured out whether it's a problem with winpty or textual. Anyway, I think Windows Terminal works much better.
Investigating further, it turns out that mintty+winpty does not send VT control sequences for mouse events, but instead place them in MOUSE_EVENT_RECORD provided that the flag ENABLE_MOUSE_INPUT is set in SetConsoleMode. However, when processing the result of ReadConsoleInput, Textual does not process mouse events, as they are assumed to have been encoded in VT sequences and arrive as key events. This explains why mouse actions have no effect in Textual under mintty+winpty.
A possible workaround on Textual side is to (1) set the ENABLE_MOUSE_INPUT flag when calling SetConsoleMode, and (2) process MOUSE_EVENT_RECORDs and translate them into VT sequences. A possible fix in mintty/winpty side is to support mouse event VT sequences.