Skip to content

Fixed issue #983: Vertical scroll bar cannot reach the bottom when the widest node scrolls out of view - #1391

Open
TetzkatLipHoka wants to merge 1 commit into
JAM-Software:masterfrom
TetzkatLipHoka:fix/issue-983-scrollrange
Open

Fixed issue #983: Vertical scroll bar cannot reach the bottom when the widest node scrolls out of view#1391
TetzkatLipHoka wants to merge 1 commit into
JAM-Software:masterfrom
TetzkatLipHoka:fix/issue-983-scrollrange

Conversation

@TetzkatLipHoka

Copy link
Copy Markdown
Contributor

Fixes #983

As analyzed in this comment: without columns, the horizontal range is computed from the visible nodes only. When the single widest node scrolls out of view, the range shrinks, the horizontal scroll bar disappears, the client area grows, and the vertical offset gets clamped back up - which makes the wide node visible again and brings the scroll bar back. There is no consistent end state that shows the last node, so the tree oscillates and the vertical scroll bar can never reach the bottom.

Any fix is therefore a semantics choice. This PR implements the least invasive one: while scrolling (DoSetOffsetXY with a vertical delta, and WMVScroll/SB_ENDSCROLL), the horizontal range may only grow, so the scroll bar cannot flip-flop mid-scroll. Any structural change or resize still recomputes the range from scratch. Documented trade-off: after the wide node scrolls out of view, the horizontal scroll bar keeps its width until the next non-scroll trigger recomputes it.

Tests/VTScrollRangeIssue983Tests.pas covers the symptom (bottom is reachable) and both halves of the contract (grow-only during scroll, full recompute on structure change). Without the fix the symptom test fails, with it the suite is green apart from the two known TestCopyHTML failures. Happy to adjust if you prefer a different semantic.

🤖 Generated with Claude Code

…ttom when the widest node scrolls out of view

Without columns the horizontal scroll range is computed from the
currently visible nodes only (GetMaxRightExtend). When the only
over-wide node scrolls out of view at the top, the range shrinks, the
horizontal scroll bar disappears, and the now taller client area
clamps the vertical offset back up - which scrolls the wide node into
view again and brings the scroll bar back. There is no consistent
state that shows the last node: with the bar the tree may scroll to
the bottom, but doing so removes the bar's reason to exist; without
the bar the allowed scroll range ends where the wide node becomes
visible again. The tree oscillates and settles at a fixed point where
the user can never reach the bottom (measured: stuck at OffsetY -5 of
-22, the last node stays clipped).

Break the cycle by making the horizontal range grow-only while the
scroll bar update is caused by scrolling itself (offset changes and
SB_ENDSCROLL): the bar then simply stays until a trigger arrives that
legitimately recomputes the range from scratch - resizing, structure
or content changes behave exactly as before.

Measured with a live window: line-scrolling now reaches OffsetY -22
with the last node fully visible, SB_ENDSCROLL keeps the position,
enlarging the window still drops the bar, and scrolling back to the
top shows it again. New regression test
Tests/VTScrollRangeIssue983Tests.pas covers the symptom and both
halves of the contract; without the fix the symptom test fails. Test
suite: 2 pre-existing failures (TestCopyHTML1/2, also failing on
unmodified master), no new failures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

Vertical Scroll Bar Cannot Scroll To Bottom In Select Circumstances

1 participant