From 3c7386dd50300c1ec7402d790f5ee5571bfff2ab Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Sat, 10 Apr 2021 23:36:38 -0700 Subject: [PATCH] Fix wheel down event on legacy pancurses --- cursive/src/backends/curses/pan.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cursive/src/backends/curses/pan.rs b/cursive/src/backends/curses/pan.rs index 9b3d317..2be1ec5 100644 --- a/cursive/src/backends/curses/pan.rs +++ b/cursive/src/backends/curses/pan.rs @@ -327,6 +327,17 @@ impl Backend { // or a weird double-release event. :S self.last_mouse_button .map(MouseEvent::Hold) + .or_else(|| { + // In legacy mode, some buttons overlap, + // so we need to disambiguate. + if mevent.bstate + == pancurses::BUTTON5_DOUBLE_CLICKED as mmask_t + { + Some(MouseEvent::WheelDown) + } else { + None + } + }) .map(&make_event) .unwrap_or_else(|| { debug!("We got a mouse drag, but no last mouse pressed?");