diff options
| author | Gabriel Schneider <[email protected]> | 2026-08-18 12:09:12 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-18 23:45:25 -0300 |
| commit | c24a9e40215bc30c68c9db7675f1c6a07d9bbae3 (patch) | |
| tree | 9afdb1f3d128bda3f3cf4837c2893982b0a8f69c /src/normal_input.zig | |
| parent | 31fece62f56aa2311e2325de83659edbc9e641db (diff) | |
| download | pardes-c24a9e40215bc30c68c9db7675f1c6a07d9bbae3.tar.gz pardes-c24a9e40215bc30c68c9db7675f1c6a07d9bbae3.zip | |
modal + file_pane: rework editing math and pane behavior, config/syntax additions, unit tests
Diffstat (limited to 'src/normal_input.zig')
| -rw-r--r-- | src/normal_input.zig | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/normal_input.zig b/src/normal_input.zig index c6b2574f..4b047a7f 100644 --- a/src/normal_input.zig +++ b/src/normal_input.zig @@ -263,7 +263,7 @@ pub const Action = union(enum) { goto: struct { target: Goto, count: u32, explicit_count: bool }, view: View, find: struct { kind: Find, char: u21, count: u32 }, - replace_char: u8, + replace_char: u21, match_bracket, textobject: struct { char: u21, around: bool }, surround_add: u21, @@ -409,8 +409,7 @@ pub fn parse(state: *State, key: Input) Result { .replace => { state.prefix = .none; const char = key.literal() orelse return .ignored; - if (char > 0x7f) return .ignored; - return resultAction(.{ .replace_char = @intCast(char) }); + return resultAction(.{ .replace_char = char }); }, .match => { if (state.match_sub == .none) { @@ -615,6 +614,13 @@ test "modified and special keys cannot satisfy literal continuations" { try std.testing.expectEqual(State{}, state); } +test "replace accepts a Unicode literal" { + var state: State = .{}; + try std.testing.expectEqual(Result.pending, parse(&state, input('r', &.{.prefix_replace}))); + try std.testing.expectEqualDeep(Result{ .action = .{ .replace_char = '界' } }, parse(&state, input('界', &.{}))); + try std.testing.expectEqual(State{}, state); +} + test "once versus per-selection is semantic action metadata" { try std.testing.expectEqual(Scope.once, (@as(Action, .search)).scope()); try std.testing.expectEqual(Scope.once, (Action{ .edit = .{ .kind = .undo, .count = 1 } }).scope()); |
