From 3e655039022d4d8231c3706a31379dad443ca19f Mon Sep 17 00:00:00 2001 From: Meredith Oleander <33614480+em-dash@users.noreply.github.com> Date: Sat, 18 Jan 2025 11:02:00 +1100 Subject: [PATCH] develop helix cursor mode --- src/tui/editor.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index c9a64b3..94ba406 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -106,6 +106,16 @@ pub const CurSel = struct { }; } + fn enable_selection_helix(self: *Self, root: Buffer.Root, metrics: Buffer.Metrics) *Selection { + return if (self.selection) |*sel| + sel + else cod: { + self.selection = Selection.from_cursor(&self.cursor); + try self.selection.?.end.move_right(root, metrics); + break :cod &self.selection.?; + }; + } + fn check_selection(self: *Self) void { if (self.selection) |sel| if (sel.empty()) { self.selection = null;