diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-28 17:56:30 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-28 21:05:25 -0300 |
| commit | f8c27dbfa9afca327189181a668f2191b499bea5 (patch) | |
| tree | dd6a984e27f5076e626635b9f557dd32ad88f6db /src/normal.zig | |
| parent | b94698696fa2482a6e5f2eeabc29d7658dcc79fa (diff) | |
| download | pardes-f8c27dbfa9afca327189181a668f2191b499bea5.tar.gz pardes-f8c27dbfa9afca327189181a668f2191b499bea5.zip | |
normal: a test that cursors landing on one place are one, a key typed there typed once, as helix merges them
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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; |
