diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-27 23:06:11 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 95a3a1bb822e583988bfe0f312d0ef219b27a454 (patch) | |
| tree | 95306e8d3f36f8af05b3ea919f6cdef1e94a028b /test/mode.zig | |
| parent | c8f0c25a854b8e169db08a84d1fdcd915a70aaa0 (diff) | |
| download | pardes-95a3a1bb822e583988bfe0f312d0ef219b27a454.tar.gz pardes-95a3a1bb822e583988bfe0f312d0ef219b27a454.zip | |
Give a pane's body its own Text holding the cursor, selections, mode and undo
acme keeps what edits a text in its Text (dat.h:171-190) and the window
holds a body and a tag of that type. The cursor, the selections, the modal
state and the edit-buffer undo move off Pane into Text.zig, Pane holds
them as its body, and the edit and normal-mode operations take the Text
they edit. Nothing changes in behaviour; this is the step that lets the
tag become a second Text.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/mode.zig')
| -rw-r--r-- | test/mode.zig | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/test/mode.zig b/test/mode.zig index cc36ac04..19d59699 100644 --- a/test/mode.zig +++ b/test/mode.zig @@ -3,9 +3,9 @@ const pardes = @import("pardes"); const panes = pardes.panes; const Pardes = pardes.Pardes; -fn mode(p: *Pardes, id: usize, expected: pardes.Pane.Mode) !void { +fn mode(p: *Pardes, id: usize, expected: panes.Text.Mode) !void { try std.testing.expect(p.executeBuiltinLine(id, "Mode")); - try std.testing.expectEqual(expected, p.panes[id].?.mode); + try std.testing.expectEqual(expected, p.panes[id].?.body.mode); try std.testing.expect(!p.panes[id].?.tag_edit); } @@ -33,14 +33,14 @@ test "Mode cycles terminal modes and keeps legacy toggle and custom tags" { p.presentation.enabled = false; while (p.nextEffect()) |_| {} const pane = p.panes[0].?; - try std.testing.expectEqual(pardes.Pane.Mode.tty, pane.mode); + try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); try std.testing.expect(std.mem.indexOf(u8, try p.tagText(p.scratch.allocator(), pane), " Mode") != null); try mode(p, 0, .normal); try mode(p, 0, .insert); try clickModeTag(p); - try std.testing.expectEqual(pardes.Pane.Mode.insert, pane.tag_mode); + try std.testing.expectEqual(panes.Text.Mode.insert, pane.tag_mode); p.update(.{ .key = .{ .cp = pardes.Key.tab } }); - try std.testing.expectEqual(pardes.Pane.Mode.tty, pane.mode); + try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); try std.testing.expect(!pane.tag_edit); while (p.nextEffect()) |effect| try std.testing.expect(effect != .write); @@ -48,11 +48,11 @@ test "Mode cycles terminal modes and keeps legacy toggle and custom tags" { try mode(p, 0, .normal); try mode(p, 0, .insert); try std.testing.expect(p.executeBuiltinLine(0, "Togglettymode")); - try std.testing.expectEqual(pardes.Pane.Mode.tty, pane.mode); + try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); p.update(.{ .key = .{ .cp = 'b', .ctrl = true } }); - try std.testing.expectEqual(pardes.Pane.Mode.normal, pane.mode); + try std.testing.expectEqual(panes.Text.Mode.normal, pane.body.mode); p.update(.{ .key = .{ .cp = 'b', .ctrl = true } }); - try std.testing.expectEqual(pardes.Pane.Mode.tty, pane.mode); + try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); try std.testing.expectEqualStrings(" Togglettymode Keep", pane.tag_tail[0..pane.tag_tail_len]); } @@ -71,19 +71,19 @@ test "Mode from actual tag Exec preserves parked file and output insert transact p.update(.{ .key = .{ .cp = 'x', .text = "x" } }); try std.testing.expectEqualStrings("界xab\n", pane.file.?.content); try clickModeTag(p); - try std.testing.expectEqual(pardes.Pane.Mode.insert, pane.tag_mode); - if (normal_tag) pane.mode = .normal; + try std.testing.expectEqual(panes.Text.Mode.insert, pane.tag_mode); + if (normal_tag) pane.body.mode = .normal; p.update(.{ .key = .{ .cp = pardes.Key.tab } }); - try std.testing.expectEqual(pardes.Pane.Mode.normal, pane.mode); + try std.testing.expectEqual(panes.Text.Mode.normal, pane.body.mode); try std.testing.expect(!pane.tag_edit); - try std.testing.expect(pane.append_at == null); + try std.testing.expect(pane.body.append_at == null); p.update(.{ .key = .{ .cp = 'u' } }); try std.testing.expectEqualStrings("ab\n", pane.file.?.content); p.update(.{ .key = .{ .cp = 'a' } }); p.update(.{ .key = .{ .cp = 'z', .text = "z" } }); - try std.testing.expect(pane.append_at != null); + try std.testing.expect(pane.body.append_at != null); try mode(p, 0, .normal); - try std.testing.expect(pane.append_at == null); + try std.testing.expect(pane.body.append_at == null); p.update(.{ .key = .{ .cp = 'u' } }); try std.testing.expectEqualStrings("ab\n", pane.file.?.content); } |
