From 2504b38647653db091aa7709afcea0dbe75f7a95 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:31:19 -0300 Subject: normal, modal, File, edit: small ones: tryFind inlined (its clamp never bound), the smart-case haystack is allocLowerString, the two WordTargets nothing produces go, File.lineCount is modal.cursorLineCount's alias, and pasteRegister and ClipRequest share one Paste enum Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/modal.zig | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/modal.zig') diff --git a/src/modal.zig b/src/modal.zig index 8a611691..9ad30d13 100644 --- a/src/modal.zig +++ b/src/modal.zig @@ -1433,11 +1433,9 @@ pub const WordTarget = enum { next_word_start, next_word_end, prev_word_start, - prev_word_end, next_long_word_start, next_long_word_end, prev_long_word_start, - prev_long_word_end, }; // helix categorize_char: Eol is its OWN category, distinct from Whitespace — @@ -1473,9 +1471,9 @@ fn isLongWordBoundary(a: WordClass, b: WordClass) bool { fn reachedWordTarget(target: WordTarget, prev: WordClass, next: WordClass) bool { return switch (target) { - .next_word_start, .prev_word_end => prev != next and (next == .eol or !isWordWhitespace(next)), + .next_word_start => prev != next and (next == .eol or !isWordWhitespace(next)), .next_word_end, .prev_word_start => prev != next and (!isWordWhitespace(prev) or next == .eol), - .next_long_word_start, .prev_long_word_end => isLongWordBoundary(prev, next) and (next == .eol or !isWordWhitespace(next)), + .next_long_word_start => isLongWordBoundary(prev, next) and (next == .eol or !isWordWhitespace(next)), .next_long_word_end, .prev_long_word_start => isLongWordBoundary(prev, next) and (!isWordWhitespace(prev) or next == .eol), }; } @@ -1529,10 +1527,7 @@ pub fn jumpWords(text: []const u8, cursor: usize, start: usize, end: usize, out: /// w/b/e/W/B/E: helix word_move — each step selects the traversed span. pub fn moveWord(text: []const u8, r0: Selection, count: usize, target: WordTarget) Selection { - const is_prev = switch (target) { - .prev_word_start, .prev_word_end, .prev_long_word_start, .prev_long_word_end => true, - else => false, - }; + const is_prev = target == .prev_word_start or target == .prev_long_word_start; if ((is_prev and r0.head == 0) or (!is_prev and r0.head == text.len)) return r0; // block-cursor prep: collapse to the 1-wide cell at the head, pointing // in the motion direction (the anchor of the input is irrelevant) -- cgit v1.3