Skip to content

Terminal view stops following output when scroll reports arrive late #686

Closed

Description

@oneo-me

Problem

A base/terminal View stops following its program's output: while a command writes quickly (a build log, a dev server), the view leaves the bottom on its own and new output is no longer shown until the user scrolls down. Seen on macOS in AgioX's run windows.

Likely cause

view.follow posts followRow, which sets v.setY and calls scrollRef.ScrollTo. The platform reports the new offset asynchronously (ItemScrollTo → EventScroll). scrolled compares each report with the single v.setY, so when a second followRow runs before the first report arrives, the first report (now stale) differs from setY by ≥ 0.5, is taken for the user's scroll, and calls ScrollToRow on the stale row: the terminal's viewport leaves the bottom and stays there.

The core already knows which reports predate scrolls it issued (scrollNode.report with the applied count), but OnScroll receives the raw reported point, so the view cannot tell them apart.

Relevant code: base/terminal/view.go follow, followRow, scrolled; core/tree.go EventScroll → reportScroll; core/tree.go scrollNode.report.

Expected

The view keeps following the end of the output while the user has not scrolled away, however fast it arrives; only the user's own scrolling moves the viewport off the bottom. A test could drive a few followRows before delivering the earlier reports.

Also wanted

An option on terminal.View to hide its scroll bar (the Scroll's HideIndicator), for apps that would rather show none.

Activity

  1. added
    bug
    on Nov 18, 2026
  2. self-assigned this
    on Nov 18, 2026
  3. oneo-me commented on Nov 18, 2026

    @oneo-me
    CollaboratorAuthor

    Working on this in branch agiox/issue-686-in-progress.

  4. oneo-me commented on Nov 18, 2026

    @oneo-me
    CollaboratorAuthor

    Fixed in #692:

    • Main cause — output faster than frames: the scroll layer was sized from the frame's scrollbar while the row it scrolled to was read later, so the platform clamped the offset to the old end and the view took the clamped report for the user's scroll, pinning the viewport off the bottom. follow now sizes the layer and picks the row from one read of the terminal.
    • Late reports: core.ScrollEvent.Stale (TSX's stale) marks a report from before the platform applied a scroll from code, using the applied count every backend sends; the terminal ignores those.
    • A report at the content's end follows the output again, so scrolling back down resumes following.
    • terminal.View.HideIndicator hides the scroll bar.

    Covered by tests for fast output, stale reports and re-following at the end, and checked by hand in AgioX's run windows on macOS.

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

Metadata

Metadata

Assignees

Labels

basebugmacOS

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions