diff options
Diffstat (limited to 'core/panes.zig')
| -rw-r--r-- | core/panes.zig | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/core/panes.zig b/core/panes.zig index e4ed3e9d..c984a73e 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -26,13 +26,17 @@ const effect_path_cap = pardes.effect_path_cap; /// Files use row zero; terminal overlays may begin anywhere in scrollback. pub const EditText = struct { text: []u8, row0: i32 }; +/// What a pane's `]` and `[` tree targets were found for (Pane.targets): +/// its text's revision, the caret's byte, the lines shown, the way. +pub const TargetsKey = struct { revision: u32, at: usize, lo: usize, hi: usize, forward: bool }; + pub const Pane = struct { /// What the replay digest leaves out (core/walk.zig): the view's geometry, /// made again from the rest (File.geometry); the other views' share of /// it (views.zig). (The 9P server's part of `fs` says so in its type.) pub const replica = .{ .local = .{ "pv", "pv_known" }, - .derived = .{ "band_rows", "ghost_at", "ghost_rows", "wrap_line", "wrap_col", "wrap_pad", "wrap_n", "body_wrapped", "context_rows", "body_rows", "body_visible_rows", "context_row_limit", "geometry_key", "geometry_len", "top_skip", "notices", "pan" }, + .derived = .{ "band_rows", "ghost_at", "ghost_rows", "wrap_line", "wrap_col", "wrap_pad", "wrap_n", "body_wrapped", "context_rows", "body_rows", "body_visible_rows", "context_row_limit", "geometry_key", "geometry_len", "top_skip", "notices", "pan", "targets" }, .len = .{ .{ "question", "question_len" }, .{ "shell_tail", "shell_tail_len" }, .{ "sel_snap", "nsel_snap" } }, // A picture's memory is its own allocator's (a dump loaded makes // it there). @@ -367,6 +371,9 @@ pub const Pane = struct { /// `ghost_at` (its line's last), the rows below drawn that many lower. /// The mouse reads it, so that a click lands on what is drawn under it. ghost_at: u16 = 0, + /// `]`'s and `[`'s tree targets as the body drawn last found them + /// (body_layer.treeTargets), and what for. + targets: struct { key: ?TargetsKey = null, lines: [3]?usize = @splat(null) } = .{}, ghost_rows: u16 = 0, /// Each other view's share of this pane, while it is not live /// (views.zig): its cursor, scroll and place in that view's layout. @@ -1254,7 +1261,9 @@ pub fn teardownPane(p: *Pardes, pane: *Pane) void { pane.jump.deinit(p.gpa); pane.places.deinit(p.gpa); p.gpa.free(pane.recipe_sels); - @import("jj.zig").forget(p, pane.serial); + // A pane that walked on (Trail.show) is the same pane on another file: + // what jj answers now is its own. + if (p.paneBySerial(pane.serial) == null) @import("jj.zig").forget(p, pane.serial); if (pane.query) |q| { q.deinit(p.gpa); p.gpa.destroy(q); |
