diff options
Diffstat (limited to 'src/normal.zig')
| -rw-r--r-- | src/normal.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/normal.zig b/src/normal.zig index 6b9508f8..fefdd88c 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -1154,6 +1154,20 @@ test "cursors that land on one place are one: a key typed there is typed once, a try std.testing.expectEqualStrings("xab\ncd\n", pane.file.?.content); } +test "r and Delete take whole graphemes" { + const gpa = std.testing.allocator; + const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 60, .rows = 12 }); + defer p.deinit(); + const pane = try p.setTestFile("A" ++ "e\u{301}" ++ "👩🏽\u{200d}🚀" ++ "🇧🇷" ++ "界" ++ "Z\n"); + // é, the astronaut and the flag: three graphemes, three 界 + for ("lv2lr") |c| handleNormal(p, &pane.body, .{ .cp = c }); + handleNormal(p, &pane.body, .{ .cp = '界' }); + try std.testing.expectEqualStrings("A界界界界Z\n", pane.file.?.content); + for ("u0li") |c| handleNormal(p, &pane.body, .{ .cp = c }); + p.update(.{ .key = .{ .cp = Key.delete } }); + try std.testing.expectEqualStrings("A" ++ "👩🏽\u{200d}🚀" ++ "🇧🇷" ++ "界" ++ "Z\n", pane.file.?.content); +} + test "tree-sitter textobject keys do in Python, JSON and Zig what hx 25.07.1 does" { if (!syntax.supportsPath("a.py") or !syntax.supportsPath("a.json") or !syntax.supportsPath("a.zig")) return; const gpa = std.testing.allocator; |
