Skip to content

Commit

Permalink
Consume all mouse events inside popups
Browse files Browse the repository at this point in the history
Fixes issues of mouse clicks "bleeding" through into the editor when
clicked on top of popups. In previous versions, mouse events were ignored
and passed into the lower layers which resulted in editor cursor being
moved when popup areas are clicked.
  • Loading branch information
sudormrfbin committed Apr 3, 2024
1 parent d05cc25 commit a97bf79
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions helix-term/src/ui/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,16 @@ impl<T: Component> Popup<T> {
match kind {
MouseEventKind::ScrollDown if self.has_scrollbar => {
self.scroll_half_page_down();
EventResult::Consumed(None)
}
MouseEventKind::ScrollUp if self.has_scrollbar => {
self.scroll_half_page_up();
EventResult::Consumed(None)
}
_ => EventResult::Ignored(None),
}
_ => {}
};

// Mouse event happened within the popup; consume the event so that
// it doesn't bleed into the editor.
EventResult::Consumed(None)
}

fn close_cb(&self) -> Callback {
Expand Down

0 comments on commit a97bf79

Please sign in to comment.