From 8421f568285b215e43a254c9a3f477aed61fa980 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 29 Jan 2026 12:39:04 +0100 Subject: [PATCH] fix: ignore spurious click events in Editor closes #471 --- src/tui/editor.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 934b61e..6ca52e2 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -2695,6 +2695,7 @@ pub const Editor = struct { } pub fn primary_click(self: *Self, y: c_int, x: c_int) !void { + if (y < 0 or x < 0) return; const root = self.buf_root() catch return; if (tui.fast_scroll()) { var at: Cursor = .{}; @@ -2718,6 +2719,7 @@ pub const Editor = struct { } pub fn primary_double_click(self: *Self, y: c_int, x: c_int) !void { + if (y < 0 or x < 0) return; const primary = self.get_primary(); const root = self.buf_root() catch return; primary.disable_selection(root, self.metrics); @@ -2731,6 +2733,7 @@ pub const Editor = struct { } pub fn primary_triple_click(self: *Self, y: c_int, x: c_int) !void { + if (y < 0 or x < 0) return; const primary = self.get_primary(); const root = self.buf_root() catch return; primary.disable_selection(root, self.metrics);