summaryrefslogtreecommitdiff
path: root/src/File.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 00:54:58 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commite988d4e24bfc0b80285754359b4b86f1b15b33f6 (patch)
tree7a0e62703f7da558e8695bcf5e2432ff1e52a464 /src/File.zig
parent7aa057e29b729ad6d9ac53e3a06f99858fc449e4 (diff)
downloadpardes-e988d4e24bfc0b80285754359b4b86f1b15b33f6.tar.gz
pardes-e988d4e24bfc0b80285754359b4b86f1b15b33f6.zip
Restore keeps each pane's dot, as acme's dump does
A restored text pane came back with its caret at its view's top, whatever had been selected. The dump now keeps each text pane's dot, q0 and q1 as acme's keeps a window's, and Restore puts it back without moving the view it kept. Two look-walk tests that restored and walked on now start from the match they were on. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/File.zig')
-rw-r--r--src/File.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/File.zig b/src/File.zig
index 929e33bf..6a1ac319 100644
--- a/src/File.zig
+++ b/src/File.zig
@@ -814,6 +814,14 @@ pub fn restore(p: *Pardes, id: usize, src: dump.Pane) !*Pane {
pane.file.?.tree_context = saved.tree_context and supportsContext(pane);
pane.body.cur_pinned = true;
pane.body.cur_row = @intCast(src.scroll);
+ // Its dot as it was, where the view the dump kept shows it.
+ if (saved.dot) |dot| if (dot[0] <= dot[1] and dot[1] <= content.len) {
+ const a = modal.positionAt(content, dot[0]);
+ const h = modal.positionAt(content, if (dot[1] > dot[0]) modal.prevGrapheme(content, dot[1]) else dot[0]);
+ pane.body.vsel = .{ .active = dot[1] > dot[0], .row = @intCast(a.row), .col = @intCast(a.col), .explicit = true };
+ pane.body.cur_row = @intCast(h.row);
+ pane.body.cur_col = @intCast(h.col);
+ };
pane.cols = @max(1, src.cols);
pane.rows = @max(1, src.rows);
if (output == null and filesystem.localPath(path) != null) p.emit(.{ .watch = .{ .pane = @intCast(id), .on = true, .mode = .baseline_disk } });