diff --git a/term/src/terminalstate/mouse.rs b/term/src/terminalstate/mouse.rs index 089552fb4..fc82f8887 100644 --- a/term/src/terminalstate/mouse.rs +++ b/term/src/terminalstate/mouse.rs @@ -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() {