Repository navigation
Description
What happens
With prompt highlighting on, the highlight band sometimes ends up on a row that
is not a prompt. In a Claude Code pane I get the default blue (#6ea8ff) band
on:
- the agent's input box, and
- the status/spinner row, e.g. a one-row band over
* Germinating… (1m 15s · ↓ 4.1k tokens)
The band travels upward as output pushes the screen along, but it no longer
lines up with the text it started on. Resizing the window repaints and the band
is gone entirely — not moved onto the right row, just gone, and it does not come
back for the prompts that already scrolled by.
Expected: the tint stays on the prompt's rows, or disappears once that row's
content is no longer the prompt. Not: an unrelated row tinted as if it were one.
Workaround
Settings → Prompts → Highlight prompt lines off. The prompt log, the outline,
the jump marks and the scrollbar ticks all keep working; only the row tint goes
away. Turning Track prompts off disables the whole feature.
Steps to reproduce
- Settings → Prompts:
Track promptsandHighlight prompt lineson (defaults). - Open a terminal pane and run an agent TUI that repaints its lower region —
Claude Code here. - Send a few prompts and let it produce enough output that each prompt scrolls
up out of the repainted region. - Watch the bands. Intermittent; a long-running turn with a live spinner is
where I see it most. - Resize the window → every band disappears.
wmux version
2.10.4
Windows version
Windows 11 23H2 (build 22631)
Anything else
Guessing at the mechanism from src/renderer/utils/prompt-marks.ts, so take
this as a lead rather than a diagnosis:
applyHighlight() anchors the decoration to an IMarker, i.e. to a buffer
line, and height rows down from it. For a shell that is the same thing as
anchoring to content — the prompt row in scrollback is never rewritten. An agent
TUI is different: it redraws its input box and status row over the same lines
over and over, and the submit-time mark sits right in that repainted zone.
refineMark() moves the mark onto the echoed prompt text once, and after that
nothing re-checks whether the row still carries the prompt. So the decoration
goes on tinting a row whose content has been replaced — which is exactly what
a band over the spinner row looks like.
The resize behaviour fits the same picture: reflow disposes the markers, the
decorations go with them, and refreshHighlights() only runs on a preference
change — so a repaint clears the bands for good rather than re-placing them.
Two directions that might help, whichever fits the design better:
- Re-validate in
decoration.onRender: the needle frombuildNeedle()is
already derivable from the stored prompt text, so a row that no longer
contains it could drop its highlight (or re-runrefineMark). - For agent-sourced prompts, hold the highlight back until the row has left the
region the TUI still rewrites (roughly: more thanterminal.rowsabove the
cursor), and keep only the rail/ruler mark until then.
Also worth considering re-applying highlights after a resize, not only after a
preference change.
Activity
fix(prompts): a highlight must not outlive the row it points at (#230)
Merge fix/230-prompt-highlight-stale-row: prompt highlight must not o…
amirlehmam commentedon Sep 12, 2026
Fixed in 2.10.5 — thanks, your lead was right about the mechanism and it saved me the diagnosis.
What it was
Your reading of
applyHighlight()is exactly it. A marker binds a decoration to a buffer line, and for a shell "line" and "content" are the same sentence — a command row in scrollback is never rewritten again. An agent TUI breaks that equivalence, and the submit-time cursor (the only line wmux has when theUserPromptSubmithook arrives) sits right in the region it repaints.refineMark()is what was supposed to get out of that, and it usually does. But it can miss — a prompt shorter thanMIN_NEEDLE(6 chars, soyes/go onare uncheckable by construction), or one the TUI reflowed or styled beyond recognition. On a miss the mark just stays on the submit-time cursor, and nothing re-checked it after that. That is your band over✳ Germinating….I reproduced it against a real xterm 6 + WebGL driving the actual module, rather than only in a fake. Pre-fix, the cell background on the spinner row reads back as
#28384e— which is#6ea8ffat the tint's 26% over the terminal background, i.e. literally the default blue you screenshotted:The fix
I took your first direction. The tint is now a claim about content and is treated as one, twice:
onRender— which turned out to be the right hook for a reason worth writing down: I measured it firing 0 times for a decoration sitting in scrollback and repeatedly for a visible one. So a band is re-checked exactly as often as it is seen, and an off-screen one costs nothing. A timer would have been the thing 0.41.0: diff surface pollsgit diff HEAD --numstatat 10-42/s and is silently auto-recreated — main process saturated, typing lag #141 in this repo is a standing warning against.A failed check drops the tint and the rail but keeps the overview-ruler tick — a tick claims "the prompt is around here", which is still true, so the fix doesn't quietly degrade into the workaround you found.
Your second direction is in there too, as the fallback for the case content can't decide: an uncheckable prompt falls back to what its source can promise. A shell's row was named by OSC 133 and keeps its band; an agent's row is a guess, so no band. That is what covers
yes.Two details, in case you read the diff:
MAX_HIGHLIGHT_ROWS;onRender, so it physically cannot re-arm itself.Needle matching also collapses whitespace on both sides now. It already did on the needle, so
git statustyped was being compared asgit statusagainst a row that still readgit status— a prompt sitting verbatim on screen could miss.On the resize half
Here I have to correct your guess, because the answer is more interesting than "reflow disposes the markers". It doesn't. I checked in the same harness: narrowing 80→40 moved
marker.line20→40 and it still pointed at the same text, through a narrow and a widen, on both renderers. xterm 6 reflows markers with their content.What actually goes stale is the decoration: its
widthisterminal.colsas it was at registration time, so widening a pane leaves every band stopping short of the new right edge. And a resize is the moment a full-screen TUI redraws everything it owns, which is when a band's row is most likely to stop carrying its prompt.So
refreshHighlightsnow runs on resize as well as on a preference change, trailing-debounced (a window drag emits a resize per frame, and up to 200 decorations per surface rebuilt on each of them is its own bug). That rebuild also re-establishes the offset above, which reflow can move.I couldn't reproduce "every band disappears and doesn't come back" in isolation, so I'd rather not claim I've explained that exact observation. What I'd expect now is that the bands you were seeing on TUI-owned rows are gone because they're never painted there, and the ones on real prompt rows come back correctly sized after a resize. If you still see a full clear-out on 2.10.5, please reopen with roughly what the pane was doing — that would be a second mechanism and I'd want it.
2.10.5 is up: https://github.com/amirlehmam/wmux/releases/tag/v2.10.5 (portable zip needs a right-click → Unblock after download). You can turn
Highlight prompt linesback on.fix(terminal): translate a touch pan into a wheel, so a finger scrolls (