summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Trail.zig4
-rw-r--r--core/tagline.zig3
2 files changed, 6 insertions, 1 deletions
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) };