1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00

Filter out per-pixel mouse movement when not in SGR-Pixels mode (#1549)

* #1457 Initial commit compiles but doesn't yet work

* #1457 Fix cell offsets

* #1457 refactor, ClickPosition

* fix nits

* #1457 filter per-pixel motion when not in SGR-Pixels mode

* Much cleaner match condition for filtering mouse events based on encoding protocol
This commit is contained in:
Autumn Lamonte 2022-01-16 20:31:56 -06:00 committed by GitHub
parent 11567c2097
commit d3df2920d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -186,7 +186,18 @@ impl TerminalState {
}
fn mouse_move(&mut self, event: MouseEvent) -> anyhow::Result<()> {
let reportable = self.any_event_mouse || !self.current_mouse_buttons.is_empty();
let moved = match (&self.last_mouse_move, self.mouse_encoding) {
(None, _) => true,
(Some(last), MouseEncoding::SgrPixels) => {
last.x != event.x
|| last.y != event.y
|| last.x_pixel_offset != event.x_pixel_offset
|| last.y_pixel_offset != event.y_pixel_offset
}
(Some(last), _) => last.x != event.x || last.y != event.y,
};
let reportable = (self.any_event_mouse || !self.current_mouse_buttons.is_empty()) && moved;
// Note: self.mouse_tracking on its own is for clicks, not drags!
if reportable && (self.button_event_mouse || self.any_event_mouse) {
match self.last_mouse_move.as_ref() {