From f9e01f71f76c55c8bf2cec5b38fc1b195e1f70ca Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Fri, 24 Jan 2025 23:23:24 +0100 Subject: [PATCH] fix(gutter): add missing abs to rel conversion in primary_click/_drag --- src/tui/editor_gutter.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tui/editor_gutter.zig b/src/tui/editor_gutter.zig index 26994d4..6d63821 100644 --- a/src/tui/editor_gutter.zig +++ b/src/tui/editor_gutter.zig @@ -273,7 +273,8 @@ fn render_diagnostic(self: *Self, diag: *const ed.Diagnostic, theme: *const Widg _ = self.plane.putc(&cell) catch {}; } -fn primary_click(self: *const Self, y: i32) error{Exit}!bool { +fn primary_click(self: *const Self, y_: i32) error{Exit}!bool { + const y = self.editor.plane.abs_y_to_rel(y_); var line = self.row + 1; line += @intCast(y); if (line > self.lines) line = self.lines; @@ -284,7 +285,8 @@ fn primary_click(self: *const Self, y: i32) error{Exit}!bool { return true; } -fn primary_drag(_: *const Self, y: i32) error{Exit}!bool { +fn primary_drag(self: *const Self, y_: i32) error{Exit}!bool { + const y = self.editor.plane.abs_y_to_rel(y_); try command.executeName("drag_to", command.fmt(.{ y + 1, 0 })); return true; }