summaryrefslogtreecommitdiff
path: root/src/normal.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:16:01 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:16:28 -0300
commit601a5c8a31aaa6c2ce7f20ae7150b1da1ac80e01 (patch)
tree3f35b16ae6ef7d552a6b72ac8e93ced4e2079dc6 /src/normal.zig
parent3671eb9eafc19549bb94fe839e944e18707316e1 (diff)
downloadpardes-601a5c8a31aaa6c2ce7f20ae7150b1da1ac80e01.tar.gz
pardes-601a5c8a31aaa6c2ce7f20ae7150b1da1ac80e01.zip
Text, normal, modal: the last f/F/t/T is kept as its Find kind (find_op: ?Find), not as the config character that bound it, and findMove and findTarget take the kind instead of two bools; Text's walked shape changes, so a client and a daemon from either side of this change refuse each other (wire semantics)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/normal.zig')
-rw-r--r--src/normal.zig25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/normal.zig b/src/normal.zig
index 48bbe915..ee39531d 100644
--- a/src/normal.zig
+++ b/src/normal.zig
@@ -462,7 +462,7 @@ const KeyState = struct {
mode: Text.Mode,
select: bool,
normal: modal.Normal.State,
- find_op: u8,
+ find_op: ?modal.Normal.Find,
find_ch: u21,
restore_cursor: bool,
reg_wait: bool,
@@ -707,22 +707,9 @@ fn executeNormalAction(p: *Pardes, t: *Text, semantic: modal.Normal.Action) void
.scroll_up => return t.scrollViewMove(text, range, -1),
},
.find => |find| {
- const op: u8 = switch (find.kind) {
- .forward => @intCast(config.find_char_fwd),
- .backward => @intCast(config.find_char_back),
- .till_forward => @intCast(config.till_char_fwd),
- .till_backward => @intCast(config.till_char_back),
- };
- t.find_op = op;
+ t.find_op = find.kind;
t.find_ch = find.char;
- return t.findMove(
- text,
- range,
- find.char,
- find.kind == .forward or find.kind == .till_forward,
- find.kind == .till_forward or find.kind == .till_backward,
- find.count,
- );
+ return t.findMove(text, range, find.char, find.kind, find.count);
},
.replace_char => |char| return edit.normalReplaceChar(p, t, char),
.match_bracket => {
@@ -775,14 +762,12 @@ fn executeNormalAction(p: *Pardes, t: *Text, semantic: modal.Normal.Action) void
.next_long_word_end => return t.wordMove(text, range, move.count, .next_long_word_end),
},
.repeat_find => |count| {
- if (t.find_op == 0) return;
- const fwd = t.find_op == config.find_char_fwd or t.find_op == config.till_char_fwd;
- const till = t.find_op == config.till_char_fwd or t.find_op == config.till_char_back;
+ const kind = t.find_op orelse return;
var repeated = range;
var moved = false;
for (0..count) |_| {
const cc = modal.selectionCursor(text, repeated);
- const target = modal.findTarget(text, cc, t.find_ch, fwd, till, 1) orelse break;
+ const target = modal.findTarget(text, cc, t.find_ch, kind, 1) orelse break;
repeated = if (t.select)
modal.moveSelectionCursor(text, repeated, target, true)
else