From f0515f28bd28703da85fbe6a95c8e819792a6002 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 00:49:57 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/normal.zig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/normal.zig') 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; -- cgit v1.3