feat: add Match.from_pos function

This commit is contained in:
CJ van den Berg 2025-10-02 16:23:21 +02:00
parent 65eb6bc7ad
commit 10bd270d89
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -74,6 +74,10 @@ pub const Match = struct {
return .{ .begin = self.begin, .end = self.end };
}
pub fn from_pos(self: Self, root: Buffer.Root, metrics: Buffer.Metrics) error{NotFound}!Self {
return from_selection(try self.to_selection().from_pos(root, metrics));
}
fn nudge_insert(self: *Self, nudge: Selection) void {
self.begin.nudge_insert(nudge);
self.end.nudge_insert(nudge);