refactor: rename is_non_word_char

This commit is contained in:
CJ van den Berg 2026-02-04 10:09:16 +01:00
parent 7520289442
commit d974d510b1
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 5 additions and 5 deletions

View file

@ -2458,7 +2458,7 @@ pub const Editor = struct {
const cursel_operator_mut = *const fn (self: *Self, root: Buffer.Root, cursel: *CurSel, allocator: Allocator) error{Stop}!Buffer.Root; const cursel_operator_mut = *const fn (self: *Self, root: Buffer.Root, cursel: *CurSel, allocator: Allocator) error{Stop}!Buffer.Root;
const cursel_operator_mut_arg = *const fn (self: *Self, root: Buffer.Root, cursel: *CurSel, allocator: Allocator, ctx: Context) error{Stop}!Buffer.Root; const cursel_operator_mut_arg = *const fn (self: *Self, root: Buffer.Root, cursel: *CurSel, allocator: Allocator, ctx: Context) error{Stop}!Buffer.Root;
pub fn is_not_word_char(c: []const u8) bool { pub fn is_non_word_char(c: []const u8) bool {
if (c.len == 0) return true; if (c.len == 0) return true;
return switch (c[0]) { return switch (c[0]) {
' ' => true, ' ' => true,
@ -2493,7 +2493,7 @@ pub const Editor = struct {
} }
pub fn is_word_char(c: []const u8) bool { pub fn is_word_char(c: []const u8) bool {
return !is_not_word_char(c); return !is_non_word_char(c);
} }
fn is_word_char_at_cursor(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool { fn is_word_char_at_cursor(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool {
@ -2501,7 +2501,7 @@ pub const Editor = struct {
} }
pub fn is_non_word_char_at_cursor(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool { pub fn is_non_word_char_at_cursor(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool {
return cursor.test_at(root, is_not_word_char, metrics); return cursor.test_at(root, is_non_word_char, metrics);
} }
pub fn is_word_boundary_left(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool { pub fn is_word_boundary_left(root: Buffer.Root, cursor: *const Cursor, metrics: Buffer.Metrics) bool {

View file

@ -829,8 +829,8 @@ fn move_cursor_word_left_helix(root: Buffer.Root, cursor: *Cursor, metrics: Buff
var next_next = next; var next_next = next;
next_next.move_left(root, metrics) catch return; next_next.move_left(root, metrics) catch return;
const cur = next.test_at(root, Editor.is_not_word_char, metrics); const cur = next.test_at(root, Editor.is_non_word_char, metrics);
const nxt = next_next.test_at(root, Editor.is_not_word_char, metrics); const nxt = next_next.test_at(root, Editor.is_non_word_char, metrics);
if (cur != nxt) { if (cur != nxt) {
try Editor.move_cursor_left(root, cursor, metrics); try Editor.move_cursor_left(root, cursor, metrics);
return; return;