From 1c96a4582267a3b762f11fe2b56679180410b6d5 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 3 Nov 2025 18:30:45 +0100 Subject: [PATCH] feat: add CurSel.merge function --- src/tui/editor.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 3cf398f..db5a46f 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -242,6 +242,16 @@ pub const CurSel = struct { return false; return self.cursor.nudge_delete(nudge); } + + fn merge(self: *Self, other: Selection) bool { + if (self.selection) |*sel_| { + if (sel_.merge(other)) { + self.cursor = sel_.end; + return true; + } + } + return self.cursor.within(other); + } }; pub const Diagnostic = struct {