From 1c29dd413e83737b91045a71c5fa500695bf1626 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 14 Sep 2025 15:26:20 +0300 Subject: ncurses: avoid the middle mouse button workaround in newer ncurses versions My patch has been merged, so there is no need to keep the workaround in newer versions. See https://lists.gnu.org/archive/html/bug-ncurses/2025-09/msg00027.html --- TODO | 17 ++++++++--------- src/interface-curses/interface.c | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index aa7fd37..d2a01b5 100644 --- a/TODO +++ b/TODO @@ -7,17 +7,16 @@ 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 + * ncurses: GNOME Terminal and Xterm produces BUTTON3_PRESSED (without BUTTON3_RELEASED) + events when scrolling horizontally. + This is fixed upstream in ncurses and there is a workaround for + older ncurses versions which limits the effects of this bug. + * ncurses: 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. + This bug has been fixed upstream and there is a workaround for + older ncurses versions. You may loose the distinction between + pressed and release events, though. * 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. diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index 5641c5d..6c8c812 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -2021,7 +2021,7 @@ teco_interface_process_mevent(MEVENT *event, GError **error) if (event->bstate & BUTTON_ALT) teco_mouse.mods |= TECO_MOUSE_ALT; -#ifdef NCURSES_UNIX +#if defined(NCURSES_UNIX) && NCURSES_VERSION_PATCH < 20250913 /* * FIXME: Some terminal emulators do not send separate * middle click PRESSED and RELEASED buttons @@ -2042,7 +2042,7 @@ teco_interface_process_mevent(MEVENT *event, GError **error) teco_mouse.type = TECO_MOUSE_RELEASED; } } -#endif /* NCURSES_UNIX */ +#endif /* NCURSES_UNIX && NCURSES_VERSION_PATCH < 20250913 */ return teco_cmdline_keymacro("MOUSE", -1, error); } -- cgit v1.2.3