mirror of
https://github.com/wez/wezterm.git
synced 2024-11-24 07:46:59 +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:
parent
11567c2097
commit
d3df2920d0
@ -186,7 +186,18 @@ impl TerminalState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn mouse_move(&mut self, event: MouseEvent) -> anyhow::Result<()> {
|
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!
|
// Note: self.mouse_tracking on its own is for clicks, not drags!
|
||||||
if reportable && (self.button_event_mouse || self.any_event_mouse) {
|
if reportable && (self.button_event_mouse || self.any_event_mouse) {
|
||||||
match self.last_mouse_move.as_ref() {
|
match self.last_mouse_move.as_ref() {
|
||||||
|
Loading…
Reference in New Issue
Block a user