From 1615cd37e8197fec9a4f26825581aecf3903e9cd Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 27 Nov 2025 16:12:38 +0100 Subject: [PATCH] refactor: add Selection.from_cursor_inclusive --- src/buffer/Selection.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/buffer/Selection.zig b/src/buffer/Selection.zig index 78ec58a..8d9057e 100644 --- a/src/buffer/Selection.zig +++ b/src/buffer/Selection.zig @@ -19,6 +19,12 @@ pub fn from_cursor(cursor: *const Cursor) Self { return .{ .begin = cursor.*, .end = cursor.* }; } +pub fn from_cursor_inclusive(cursor: *const Cursor, root: Buffer.Root, metrics: Buffer.Metrics) Self { + var sel: Self = .{ .begin = cursor.*, .end = cursor.* }; + sel.end.move_right(root, metrics) catch {}; + return sel; +} + pub fn from_pos(sel: Self, root: Buffer.Root, metrics: Buffer.Metrics) Self { return .{ .begin = .{