refactor: add Selection.from_cursor_inclusive

This commit is contained in:
CJ van den Berg 2025-11-27 16:12:38 +01:00
parent bb53ba0fc1
commit 1615cd37e8
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -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 = .{