diff options
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) |
