diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:31:19 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:16:28 -0300 |
| commit | 2504b38647653db091aa7709afcea0dbe75f7a95 (patch) | |
| tree | 2fefb992a86d2432c00ab4b431f65b649421a0dd /src/modal.zig | |
| parent | 2aa1801dbad2a26348aef085d9dee8096f8d2eb3 (diff) | |
| download | pardes-2504b38647653db091aa7709afcea0dbe75f7a95.tar.gz pardes-2504b38647653db091aa7709afcea0dbe75f7a95.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/modal.zig')
| -rw-r--r-- | src/modal.zig | 11 |
1 files changed, 3 insertions, 8 deletions
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) |
