summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-27 23:06:11 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commit95a3a1bb822e583988bfe0f312d0ef219b27a454 (patch)
tree95306e8d3f36f8af05b3ea919f6cdef1e94a028b /src/ninep/ctl.zig
parentc8f0c25a854b8e169db08a84d1fdcd915a70aaa0 (diff)
downloadpardes-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 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 645b1c33..484b08c9 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -297,9 +297,9 @@ test "the pane ctl takes get, lock and unlock, and nothing that a file of its ow
defer p.deinit();
const ctl_node = Node.of(serialOf(p), .ctl);
for ([_][]const u8{
- "menu", "nomenu", "dump echo hi", "font Go Mono", "lock x", "bogus", "DEL",
- "name x.txt", "put", "del", "delete", "Look x", "Exec Save", "clean",
- "dirty", "cleartag", "dot=addr", "addr=dot", "show", "mark", "nomark",
+ "menu", "nomenu", "dump echo hi", "font Go Mono", "lock x", "bogus", "DEL",
+ "name x.txt", "put", "del", "delete", "Look x", "Exec Save", "clean",
+ "dirty", "cleartag", "dot=addr", "addr=dot", "show", "mark", "nomark",
"scroll", "limit=addr", "get x", "look /tmp", "exec Del",
}) |bad| try testing.expectEqual(E.INVAL, wr(p, ctl_node, bad).errno());
try testing.expect(p.paneBySerial(serialOf(p)) != null);
@@ -447,27 +447,27 @@ test "look opens spaced paths and locations without editing the source pane" {
const look_node = Node.of(source.serial, .look);
const revision = source.file.?.revision;
const undo_len = source.file.?.history.undo_len;
- source.cur_col = 3;
+ source.body.cur_col = 3;
var clicked: [4200]u8 = undefined;
try testing.expectEqual(Status.ok, wr(p, look_node, try std.fmt.bufPrint(&clicked, "{s}:2:3\n", .{path})).reply.status);
const opened = p.panes[p.active].?;
try testing.expect(opened != source);
try testing.expectEqualStrings(path, opened.file.?.path);
try testing.expectEqualStrings("first\nsecond\nthird\n", opened.file.?.content);
- try testing.expectEqual(@as(i32, 1), opened.cur_row);
- try testing.expectEqual(@as(i32, 2), opened.cur_col);
+ try testing.expectEqual(@as(i32, 1), opened.body.cur_row);
+ try testing.expectEqual(@as(i32, 2), opened.body.cur_col);
try testing.expectEqualStrings("source stays intact\n", source.file.?.content);
try testing.expectEqual(revision, source.file.?.revision);
try testing.expectEqual(undo_len, source.file.?.history.undo_len);
- try testing.expectEqual(@as(i32, 3), source.cur_col);
+ try testing.expectEqual(@as(i32, 3), source.body.cur_col);
var expected: [16]u8 = undefined;
try testing.expectEqualStrings(try std.fmt.bufPrint(&expected, "{d}\n", .{opened.serial}), rd(p, root_look, 0, 4096).bytes);
p.active = 0;
try testing.expectEqual(Status.ok, wr(p, root_look, try std.fmt.bufPrint(&clicked, "{s}:3:2\n", .{path})).reply.status);
try testing.expect(p.panes[p.active].? == opened);
- try testing.expectEqual(@as(i32, 2), opened.cur_row);
- try testing.expectEqual(@as(i32, 1), opened.cur_col);
+ try testing.expectEqual(@as(i32, 2), opened.body.cur_row);
+ try testing.expectEqual(@as(i32, 1), opened.body.cur_col);
try testing.expectEqualStrings(try std.fmt.bufPrint(&expected, "{d}\n", .{opened.serial}), rd(p, root_look, 0, 4096).bytes);
}