diff options
Diffstat (limited to 'src/normal.zig')
| -rw-r--r-- | src/normal.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/normal.zig b/src/normal.zig index f5bdb9dc..9cac18b0 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -1247,6 +1247,21 @@ test "one cursor holds no room for other ranges; a second range makes it and one try std.testing.expectEqual(@as(usize, 0), pane.body.sels.len); } +test "cursors that land on one place are one: a key typed there is typed once, as helix merges them" { + 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("ab\ncd\n"); + // A cursor below, then both up: the second lands on the first. + handleNormal(p, &pane.body, .{ .cp = 'C' }); + try std.testing.expectEqual(@as(u16, 1), pane.body.nsel); + handleNormal(p, &pane.body, .{ .cp = 'k' }); + try std.testing.expectEqual(@as(u16, 0), pane.body.nsel); + p.update(.{ .key = .{ .cp = 'i', .text = "i" } }); + p.update(.{ .key = .{ .cp = 'x', .text = "x" } }); + try std.testing.expectEqualStrings("xab\ncd\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; |
