summaryrefslogtreecommitdiff
path: root/src/normal_input.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/normal_input.zig')
-rw-r--r--src/normal_input.zig12
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());