refactor: add Cursor.egc_at helper function

This commit is contained in:
CJ van den Berg 2025-03-04 19:05:07 +01:00
parent b7aa8cd6a7
commit 67c386d5b7
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -176,6 +176,10 @@ fn is_at_end(self: *const Self, root: Buffer.Root, metrics: Metrics) bool {
return if (self.row < root.lines()) self.col == root.line_width(self.row, metrics) catch 0 else true;
}
pub fn egc_at(self: *const Self, root: Buffer.Root, metrics: Metrics) error{NotFound}!struct { []const u8, usize, usize } {
return root.egc_at(self.row, self.col, metrics);
}
pub fn test_at(self: *const Self, root: Buffer.Root, pred: *const fn (c: []const u8) bool, metrics: Metrics) bool {
return root.test_at(pred, self.row, self.col, metrics);
}