refactor: add Selection.from_cursor_inclusive
This commit is contained in:
parent
bb53ba0fc1
commit
1615cd37e8
1 changed files with 6 additions and 0 deletions
|
|
@ -19,6 +19,12 @@ pub fn from_cursor(cursor: *const Cursor) Self {
|
||||||
return .{ .begin = cursor.*, .end = cursor.* };
|
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 {
|
pub fn from_pos(sel: Self, root: Buffer.Root, metrics: Buffer.Metrics) Self {
|
||||||
return .{
|
return .{
|
||||||
.begin = .{
|
.begin = .{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue