diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-08 20:45:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-08 21:48:19 -0300 |
| commit | d31cc9eb97da97e3cb5268565ced3bf8c25f8540 (patch) | |
| tree | 595dba9ef28752b3a1f37cf33229fdc153215362 /test | |
| parent | c35251904681f3a195a6ede71dba235463b0e962 (diff) | |
| download | pardes-d31cc9eb97da97e3cb5268565ced3bf8c25f8540.tar.gz pardes-d31cc9eb97da97e3cb5268565ced3bf8c25f8540.zip | |
fix: a raw terminal's key whose text passed forwardKey's 256-byte buffer (an input method's commit, a paste as one key) was dropped with no word: the encoding grows past the stack's room onto the heap and goes out through emitWrite, cut into writes in order; a failure to grow is reported; a pane test forwards 1000 bytes of key text and reads them back whole
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test')
| -rw-r--r-- | test/panes.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/panes.zig b/test/panes.zig index 55ad303d..f221499b 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -2580,6 +2580,22 @@ const TerminalTests = struct { } } + test "a raw terminal key whose text passes one write goes whole, in writes in order" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + // A paste delivered as one key's text (an input method's commit). + const text: []const u8 = &@as([1000]u8, @splat('x')); + forwardKey(p, 0, .{ .cp = 'p', .text = text }); + var got: std.ArrayList(u8) = .empty; + defer got.deinit(std.testing.allocator); + while (p.nextEffect()) |effect| switch (effect) { + .write => |write| try got.appendSlice(std.testing.allocator, write.bytes.slice()), + else => return error.UnexpectedEffect, + }; + try std.testing.expectEqualStrings(text, got.items); + } + test "an edit buffer slides shell rows and their colors together" { const testing = std.testing; const p = try Pardes.init(testing.allocator, .{ .startup_config = "Theme helix\n", .tty_only = true, .cols = 18, .rows = 12 }); |
