From cfe32e52db251f3102fd724fc1121d2e7819d0fd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 24 Nov 2026 20:34:09 -0300 Subject: walk, a fix on top of the frozen items 1-3: what the walk costs where there is none: Trail.edited (an edit holds the panes showing its file) returns at once under `Jumps new-pane` and for an output, a listing, a pager or a Mini, where no pane can read, and tagline.nameAt and forwardSpan return at once for a pane with no walk; RUN FIRST: the gate against tree7, its per-op counts set beside main's own gate merge70-g's (the same base): body-appends +0.16% on every size (+30,860 instructions an op, the same on each: Trail.edited's 64-slot loop at each of its 9P appends to a file pane), client-key-down +0.07 to +0.13%; the counts after it are in the next gate Co-Authored-By: Claude Opus 5.5 --- core/Trail.zig | 4 ++++ core/tagline.zig | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/Trail.zig b/core/Trail.zig index 69f149df..01d650a5 100644 --- a/core/Trail.zig +++ b/core/Trail.zig @@ -212,7 +212,11 @@ pub fn keep(pane: *Pane) void { } /// An edit of file `f`: the panes showing it are held from now on (ยง6.5). +/// Only where a pane could read: a session whose jumps walk, a file +/// (isFile), so that an edit anywhere else (an output's, a 9P append's +/// under `Jumps new-pane`) costs nothing past these checks. pub fn edited(p: *Pardes, f: *const panes.File.State) void { + if (p.settings.jumps != .walk or f.output != null or f.listing != null or f.pager or f.mini != null) return; for (p.panes) |slot| { const pane = slot orelse continue; if (pane.trail.held) continue; diff --git a/core/tagline.zig b/core/tagline.zig index 451198fd..d56f8562 100644 --- a/core/tagline.zig +++ b/core/tagline.zig @@ -183,12 +183,13 @@ pub fn pathPrefix(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]co /// Where a file's name starts in its tag: after its walk's back steps. pub fn nameAt(pane: *const Pane) usize { - return if (pane.file != null) pane.trail.bytes(.back) else 0; + return if (pane.file != null and pane.trail.n > 0) pane.trail.bytes(.back) else 0; } /// The bytes of a file's tag its walk's forward steps take, after its name. pub fn forwardSpan(pane: *const Pane) [2]usize { const f = pane.file orelse return .{ 0, 0 }; + if (pane.trail.n == 0) return .{ 0, 0 }; const name = if (pane.prompt == .name) pane.input.own orelse f.path else f.path; const lo = pane.trail.bytes(.back) + name.len; return .{ lo, lo + pane.trail.bytes(.forward) }; -- cgit v1.3