From 616709ae2c0b26486369d94159c262f91d407fbd Mon Sep 17 00:00:00 2001 From: rhodes-b <59537185+rhodes-b@users.noreply.github.com> Date: Tue, 24 Dec 2024 17:01:15 -0600 Subject: [PATCH] selection quit when we jump to update outside of viewport --- src/Surface.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index 1442af869..041301796 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -3394,7 +3394,7 @@ pub fn cursorPosCallback( // We allow for a 1 pixel buffer at the top and bottom to detect // scroll even in full screen windows. // Note: one day, we can change this from distance to time based if we want. - //log.warn("CURSOR POS: {} {}", .{ pos, self.size.screen }); + // log.warn("CURSOR POS: {} {}", .{ pos, self.size.screen }); const max_y: f32 = @floatFromInt(self.size.screen.height); if (pos.y <= 1 or pos.y > max_y - 1) { const delta: isize = if (pos.y < 0) -1 else 1; @@ -3417,6 +3417,12 @@ pub fn cursorPosCallback( return; }; + // handle the case where we go outside of the viewport + // which is represented by a negative position for both x and y + if (pos.x < 0 and pos.y < 0) { + return; + } + // Handle dragging depending on click count switch (self.mouse.left_click_count) { 1 => try self.dragLeftClickSingle(pin, pos.x), @@ -3548,7 +3554,6 @@ fn dragLeftClickSingle( // ALWAYS selected the current char, but we must move the cursor // left of the xboundary. // - Inverted logic for forwards selections. - // // Our clicking point const click_pin = self.mouse.left_click_pin.?.*;