From a673fe139a7cc44a7f2b4839aaa78124c49c4b75 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 9 Sep 2025 20:35:17 +0300 Subject: work around ncurses mouse handling bugs * We have to process several mouse events for every KEY_MOUSE. * The order of events is sort of arbitrary after clicking the middle mouse button in some terminal emulators like st and Xterm. Therefore BUTTON2_PRESSED is now ignored and resynthesized when receiving BUTTON2_RELEASED. This fixes loosing middle click events. fnkeys.tes only processes the RELEASED event anyway. I am still looking for a fix to contribute to the ncurses project. * In GNOME Terminal and Xterm with the SGR mouse protocol, you can receive bogus BUTTON3_PRESSED events when left scrolling. There is an upstream fix. As a workaround -- we will have to live with outdated ncurses versions anyway -- we prevent resetting the mouse mask unnecessarily. This limits the effects to a single bogus BUTTON3_PRESSED event. Unfortunately, it's not easily possible to force ncurses into using the X10 mouse protocol even if the terminfo entry claims SGR compatibility. See also https://lists.gnu.org/archive/html/bug-ncurses/2025-09/msg00016.html --- TODO | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'TODO') diff --git a/TODO b/TODO index e8a1ddc..aa7fd37 100644 --- a/TODO +++ b/TODO @@ -7,6 +7,17 @@ Tasks: similar to double right click. Known Bugs: + * GNOME Terminal and Xterm produces BUTTON3_PRESSED (without BUTTON3_RELEASED) events + when scrolling horizontally. + This is a confirmed ncurses bug, which will be fixed + but we have to live with old ncurses versions as well. + We limit the effect of this bug by not resetting the mousemask() + unnecessarily. + * Curses: st and Xterm produce BUTTON2_RELEASED, followed by BUTTON2_PRESSED + when clicking the middle button. + We also *sometimes* get it in the correct order. + This is apparently an ncurses bug. + We work around this by synthesizing BUTTON2_PRESSED when receiving BUTTON2_RELEASED. * Upgrade to Scintilla 5.5.7 requires charconv header which bumps the minimum GCC version to 8.1 (officially 9). This breaks OpenSUSE 15.5-15.6 builds. -- cgit v1.2.3