From 40809835ae2cc9f2ceccc974437b1f99783885d0 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Tue, 22 Oct 2024 19:07:26 +0200 Subject: [PATCH] fix: don't repeatedly send hover requests for the same editor cell --- src/tui/editor.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 6188ff6..bc2de7b 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -4076,9 +4076,13 @@ pub const EditorWidget = struct { var bytes: []u8 = ""; if (try m.match(.{ "M", tp.extract(&x), tp.extract(&y), tp.extract(&xpx), tp.extract(&ypx) })) { - self.hover_y, self.hover_x = self.editor.plane.abs_yx_to_rel(y, x); - if (self.editor.jump_mode) - self.update_hover_timer(.init); + const hover_y, const hover_x = self.editor.plane.abs_yx_to_rel(y, x); + if (hover_y != self.hover_y or hover_x != self.hover_x) { + self.hover_y, self.hover_x = .{ + hover_y, hover_x }; + if (self.editor.jump_mode) + self.update_hover_timer(.init); + } } else if (try m.match(.{ "B", tp.extract(&evtype), tp.extract(&btn), tp.any, tp.extract(&x), tp.extract(&y), tp.extract(&xpx), tp.extract(&ypx) })) { try self.mouse_click_event(evtype, btn, y, x, ypx, xpx); } else if (try m.match(.{ "D", tp.extract(&evtype), tp.extract(&btn), tp.any, tp.extract(&x), tp.extract(&y), tp.extract(&xpx), tp.extract(&ypx) })) {