refactor: fix spelling of egc_at function

This commit is contained in:
CJ van den Berg 2025-03-04 18:50:38 +01:00
parent 1acee03ea9
commit e285099253
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 7 additions and 7 deletions

View file

@ -524,7 +524,7 @@ const Node = union(enum) {
if (!found) return error.NotFound; if (!found) return error.NotFound;
} }
pub fn ecg_at(self: *const Node, line: usize, col: usize, metrics: Metrics) error{NotFound}!struct { []const u8, usize, usize } { pub fn egc_at(self: *const Node, line: usize, col: usize, metrics: Metrics) error{NotFound}!struct { []const u8, usize, usize } {
const ctx_ = struct { const ctx_ = struct {
col: usize, col: usize,
at: ?[]const u8 = null, at: ?[]const u8 = null,
@ -545,8 +545,8 @@ const Node = union(enum) {
} }
pub fn test_at(self: *const Node, pred: *const fn (c: []const u8) bool, line: usize, col: usize, metrics: Metrics) bool { pub fn test_at(self: *const Node, pred: *const fn (c: []const u8) bool, line: usize, col: usize, metrics: Metrics) bool {
const ecg, _, _ = self.ecg_at(line, col, metrics) catch return false; const egc, _, _ = self.egc_at(line, col, metrics) catch return false;
return pred(ecg); return pred(egc);
} }
pub fn get_line_width_map(self: *const Node, line: usize, map: *ArrayList(usize), metrics: Metrics) error{ Stop, NoSpaceLeft }!void { pub fn get_line_width_map(self: *const Node, line: usize, map: *ArrayList(usize), metrics: Metrics) error{ Stop, NoSpaceLeft }!void {

View file

@ -40,7 +40,7 @@ fn move_right_no_target(self: *Self, root: Buffer.Root, metrics: Metrics) !void
const lines = root.lines(); const lines = root.lines();
if (lines <= self.row) return error.Stop; if (lines <= self.row) return error.Stop;
if (self.col < root.line_width(self.row, metrics) catch 0) { if (self.col < root.line_width(self.row, metrics) catch 0) {
_, const wcwidth, const offset = root.ecg_at(self.row, self.col, metrics) catch return error.Stop; _, const wcwidth, const offset = root.egc_at(self.row, self.col, metrics) catch return error.Stop;
self.col += wcwidth - offset; self.col += wcwidth - offset;
} else if (self.row < lines - 1) { } else if (self.row < lines - 1) {
self.col = 0; self.col = 0;
@ -59,7 +59,7 @@ fn move_left_no_target(self: *Self, root: Buffer.Root, metrics: Metrics) !void {
self.row -= 1; self.row -= 1;
self.col = root.line_width(self.row, metrics) catch 0; self.col = root.line_width(self.row, metrics) catch 0;
} else { } else {
_, const wcwidth, _ = root.ecg_at(self.row, self.col - 1, metrics) catch return error.Stop; _, const wcwidth, _ = root.egc_at(self.row, self.col - 1, metrics) catch return error.Stop;
if (self.col > wcwidth) self.col -= wcwidth else self.col = 0; if (self.col > wcwidth) self.col -= wcwidth else self.col = 0;
} }
} }

View file

@ -2994,7 +2994,7 @@ pub const Editor = struct {
return error.Stop; return error.Stop;
try move_cursor_left(root, cursor, metrics); try move_cursor_left(root, cursor, metrics);
while (true) { while (true) {
const curr_egc, _, _ = root.ecg_at(cursor.row, cursor.col, metrics) catch return error.Stop; const curr_egc, _, _ = root.egc_at(cursor.row, cursor.col, metrics) catch return error.Stop;
if (std.mem.eql(u8, curr_egc, egc)) if (std.mem.eql(u8, curr_egc, egc))
return; return;
if (is_eol_left(root, cursor, metrics)) if (is_eol_left(root, cursor, metrics))
@ -3009,7 +3009,7 @@ pub const Editor = struct {
return error.Stop; return error.Stop;
try move_cursor_right(root, cursor, metrics); try move_cursor_right(root, cursor, metrics);
while (true) { while (true) {
const curr_egc, _, _ = root.ecg_at(cursor.row, cursor.col, metrics) catch return error.Stop; const curr_egc, _, _ = root.egc_at(cursor.row, cursor.col, metrics) catch return error.Stop;
if (std.mem.eql(u8, curr_egc, egc)) if (std.mem.eql(u8, curr_egc, egc))
return; return;
if (is_eol_right(root, cursor, metrics)) if (is_eol_right(root, cursor, metrics))