fix(infinity-agent-cli): don't eat scrollback when a resize races the re-anchor cursor query - #89
Open
shadaj wants to merge 1 commit into
Open
fix(infinity-agent-cli): don't eat scrollback when a resize races the re-anchor cursor query#89shadaj wants to merge 1 commit into
shadaj wants to merge 1 commit into
Conversation
… re-anchor cursor query When the terminal is resized continuously (e.g. dragging a pane divider in Zed), the terminal keeps reflowing while the viewport's re-anchor cursor query (`CSI 6n`) is in flight. Acting on the stale reply re-saved the anchor too high (a growing reflow pulls scrollback rows down, moving the true anchor with them) and the subsequent clear-from-anchor-down erased the tail of the assistant output. * `InlineViewport::re_anchor` now re-checks the terminal size after every cursor-query round-trip and, if the geometry moved again, absorbs the new resize and re-queries until stable * `InlineViewport::draw` runs `re_anchor` before computing any geometry-dependent values (frame area, ideal viewport position), so a draw that absorbs a raced resize is fully consistent with the newest geometry * Regression test `tui_resize_race.rs` reproduces the race with a `TermOut` interposer that resizes the emulator right after answering the cursor query (before the fix, 6 of 30 output lines were erased) * Test harness: `TuiHarness::spawn_with_term` allows spawning the TUI against a caller-provided `TermOut` and event channel Co-authored-by: Infinity 🤖 <infinity@hydro.run> PR: #89
Deploying infinity with
|
| Latest commit: |
acf5e0f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fff4e7ca.infinity-dc7.pages.dev |
| Branch Preview URL: | https://sandbox-5c18c70b-5b5d-4cee-9.infinity-dc7.pages.dev |
shadaj
marked this pull request as ready for review
July 29, 2026 21:59
shadaj
force-pushed
the
sandbox-5c18c70b-5b5d-4cee-90a3-933c3ade71e3
branch
from
August 4, 2026 19:02
a4fb040 to
acf5e0f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the terminal is resized continuously (e.g. dragging a pane divider in
Zed), the terminal keeps reflowing while the viewport's re-anchor cursor
query (
CSI 6n) is in flight. Acting on the stale reply re-saved the anchortoo high (a growing reflow pulls scrollback rows down, moving the true anchor
with them) and the subsequent clear-from-anchor-down erased the tail of the
assistant output.
InlineViewport::re_anchornow re-checks the terminal size after everycursor-query round-trip and, if the geometry moved again, absorbs the new
resize and re-queries until stable
InlineViewport::drawrunsre_anchorbefore computing anygeometry-dependent values (frame area, ideal viewport position), so a draw
that absorbs a raced resize is fully consistent with the newest geometry
tui_resize_race.rsreproduces the race with aTermOutinterposer that resizes the emulator right after answering the cursor
query (before the fix, 6 of 30 output lines were erased)
TuiHarness::spawn_with_termallows spawning the TUIagainst a caller-provided
TermOutand event channel