summaryrefslogtreecommitdiff
path: root/src/normal.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 00:49:57 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:17:28 -0300
commitf0515f28bd28703da85fbe6a95c8e819792a6002 (patch)
tree2ac434d7cee58c6848c88a1815caed60673feb99 /src/normal.zig
parentd5158f6a69ce5a1af6372c140b07379ee0ba2446 (diff)
downloadpardes-f0515f28bd28703da85fbe6a95c8e819792a6002.tar.gz
pardes-f0515f28bd28703da85fbe6a95c8e819792a6002.zip
modal, edit, normal: the selection ops splice their primary range's offsets (Text.primaryRange): d, c, the selection's text, r, R and the chords' replace, ~ ` Alt-`, C-a and C-x, ms, md and insert-mode Delete; selRange and the cursor-pair half of modal's row/col edit layer go (rangeBytes, rangeText, deleteRange, replaceRange, replaceChars, deleteChar, clearLine, lineFrom), with their unit tests, and deleteLines no longer builds the removed text no caller read; a key-level test pins r and Delete on whole graphemes; the insert-mode and paste ops keep insertAt, deleteSpan, pasteLineBelow and advanceBy, whose callers hold cells; no key does anything new
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/normal.zig')
-rw-r--r--src/normal.zig14
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;