From 0bff30e9544366398f247788f133690f0c7c2f3f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Aug 2020 21:48:41 +0530 Subject: [PATCH] Send wheel events to program when it asks to grab mouse, even in main screen This matches behavior of other terminals and I dont have a strong preference either way. Fixes #2939 --- docs/changelog.rst | 4 ++++ kitty/mouse.c | 21 +++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f479ed1fb..ca521c74e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -24,6 +24,10 @@ To update |kitty|, :doc:`follow the instructions `. - Allow specifying watchers in session files and via a command line argument (:iss:`2933`) +- When in the main screen and a program grabs the mouse, do not use the scroll + wheel events to scroll the scrollback buffer, instead send them to the + program (:iss:`2939`) + 0.18.3 [2020-08-11] ------------------- diff --git a/kitty/mouse.c b/kitty/mouse.c index 191b355fe..d9439aec8 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -702,20 +702,17 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags, int modifiers) { } if (s == 0) return; bool upwards = s > 0; - if (screen->linebuf == screen->main_linebuf) { - screen_history_scroll(screen, abs(s), upwards); - } else { - if (screen->modes.mouse_tracking_mode) { - int sz = encode_mouse_scroll(w, upwards, modifiers); - if (sz > 0) { - mouse_event_buf[sz] = 0; - for (s = abs(s); s > 0; s--) { - write_escape_code_to_child(screen, CSI, mouse_event_buf); - } + if (screen->modes.mouse_tracking_mode) { + int sz = encode_mouse_scroll(w, upwards, modifiers); + if (sz > 0) { + mouse_event_buf[sz] = 0; + for (s = abs(s); s > 0; s--) { + write_escape_code_to_child(screen, CSI, mouse_event_buf); } - } else { - fake_scroll(w, abs(s), upwards); } + } else { + if (screen->linebuf == screen->main_linebuf) screen_history_scroll(screen, abs(s), upwards); + else fake_scroll(w, abs(s), upwards); } }