Skip to content

fix(mux): report the geometry that follows the rows a push copied - #34

Draft
Mirr0ch1 wants to merge 1 commit into
RoversX:mainfrom
Mirr0ch1:fix/mux-consistent-render
Draft

Mirr0ch1 wants to merge 1 commit into
RoversX:mainfrom
Mirr0ch1:fix/mux-consistent-render

Conversation

@Mirr0ch1

@Mirr0ch1 Mirr0ch1 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A candidate fix for the fast-output viewport tear discussed in #29 (the image-independent one, seen with a ThinkTerm scrollbar on a remote GUI).

read_pane_changes read the dimensions, cursor and sequence number, then took the terminal lock again for the viewport rows. The pane's parser runs on its own thread and holds the terminal lock per output batch, so it can scroll the screen between those reads. The rows then come from the old viewport, while the push reports the old physical_top as the live screen. A client scrolled back can render an old row at a stable index that now holds a different line, and the result is the top-frozen / bottom-following tear.

This re-reads the geometry after the rows and reports that later state:

  • rows copied from the old viewport are labelled as history (correct: they are scrollback by then);
  • the new live rows are not claimed by this push and are fetched by the client's next paint;
  • the dirty set is recomputed against the later geometry.

This is server-side only; the client does not need a rebuild.

Validation

  • cargo check -p wezterm-mux-server clean.
  • Manual: server scrollback_lines=200, fast output, scroll up. The view stays coherent and the scrollbar tracks the trim.
  • Not yet confirmed against the reporter's macOS trackpad + omp case, so this is a draft: the local reproduction does not reliably show the tear. The hypothesis is the interleaving above; if the tear survives this change, the next step is a client-side viewport/cache instrument rather than this server snapshot.

Part of #29. This is the fast-output viewport half; the history-loss half is #31.

Third-party material

None.

Contributor agreement

I agree to the ThinkTerm Contributor Agreement version 1.2 for this contribution, including the permission for a future MIT release and the patent license, and confirm I am authorized to make these grants.

read_pane_changes read the dimensions, cursor and sequence number, then
took the terminal lock again for the viewport rows. A parser batch can
scroll the screen between those reads; the rows then come from the old
viewport while the push labels them as the live screen. A client
scrolled back can show an old row at a stable index that now holds a
different line, which is the top/bottom tear seen when a fast program
scrolls under a reader.

Re-read the geometry after the rows and report that later state. Rows
from the old viewport are then correctly labelled as history; the new
live rows are fetched by the client's next paint.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant