szn

Bug 433 — Pane-border-format cache invalidated only on option change, not on resize/split

433. Pane-border-format cache invalidated only on option change, not on resize/split

Severity: MEDIUM-HIGH Status: Fixed

The per-pane border-format cache is keyed by a generation counter that moves only when the pane-border-format option string itself changes:

// src/cmd/cmd.zig:964-971
if (std.mem.eql(u8, option_name, "pane-border-format")) {
    if (server.activeSession()) |session| {
        session.border_format_gen +%= 1;
    }
}

The render path serves the cached already-expanded string whenever the generation still matches:

// src/server/server.zig:3031
if (pb.pane.border_format_gen == border_gen and pb.pane.border_format_cached != null) {
    pb.border_format = pb.pane.border_format_cached.?; // stale if dims changed
    continue;
}

Problem & Impact

Proposed Fix

Bump session.border_format_gen on any layout/geometry change that affects pane dimensions or ordering (resize, split, kill-pane, swap, rotate), not just on option edits. Or re-expand every frame and use the cache only for the compiled ops (not the substituted string).