From 67c386d5b71271d10e8d813e8f577b9ad6123f0e Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Tue, 4 Mar 2025 19:05:07 +0100 Subject: [PATCH] refactor: add Cursor.egc_at helper function --- src/buffer/Cursor.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/buffer/Cursor.zig b/src/buffer/Cursor.zig index d53d2b4..23e562b 100644 --- a/src/buffer/Cursor.zig +++ b/src/buffer/Cursor.zig @@ -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); }