Skip to content

Fixed issue #1091: Bands disappear with explorer theme - #1383

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

Fixed issue #1091: Bands disappear with explorer theme#1383
TetzkatLipHoka wants to merge 1 commit into
JAM-Software:masterfrom
TetzkatLipHoka:fix/issue-1091-bands

Conversation

@TetzkatLipHoka

Copy link
Copy Markdown
Contributor

Fixes #1091.

Cause

With the explorer theme active, DetermineLineImageAndSelectLevel() suppresses the tree line under the expand button by overwriting the last line image entry with ltNone.

The band conversion in PaintTreeLines() however relies on its documented invariant that ltNone never appears as the last entry ("A no line entry can never appear as last entry so I don't need an end check here"): on ltNone it takes over the style of the entry to the right, which for the last entry is an out-of-bounds read of the dynamic array — with range checking enabled this raises ERangeError.

The resulting garbage styles made the bands of every collapsed node with children disappear, while expanded nodes stayed intact (they take the vsExpanded branch of the conversion) — matching the screenshot in the issue. Without a themed application manifest the bug does not reproduce, which is why it is easy to miss in test programs.

Fix

Skip the suppression when LineMode = lmBands: bands are box edges, not lines pointing at a button, so there is nothing to suppress. One condition, no behavior change for lmNormal.

Verification

  • Reproduced with the reporter's project from the issue (themed manifest): before the fix the bands of all collapsed parent rows are missing; after the fix the rendering is identical to the unthemed one.
  • New regression test Tests/VTBandsIssue1091Tests.pas renders offscreen and compares band pixels (count plus position checksum) with and without the tsUseExplorerTheme state, following the pattern of the existing paint tests. Without the fix it fails (53 of 1954 band pixels missing in the test scenario), with the fix it passes.
  • Full test suite: no new failures (the two TestCopyHTML failures also occur on unmodified master).

🤖 Generated with Claude Code

With the explorer theme active, DetermineLineImageAndSelectLevel()
suppresses the tree line under the expand button by overwriting the
last line image entry with ltNone. The band conversion in
PaintTreeLines() however relies on the documented invariant that
ltNone never appears as the last entry: on ltNone it takes over the
style of the entry to the right, which for the last entry is an
out-of-bounds read of the dynamic array (raises ERangeError with
range checking on). The resulting garbage styles made the bands of
every collapsed node with children disappear, while expanded nodes
stayed intact - matching the screenshot in the issue.

Skip the suppression in band mode: bands are box edges, not lines
pointing at a button, so there is nothing to suppress.

Measured offscreen via pixel counting (see new regression test):
identical band rendering with and without the explorer theme state
after the fix; before, 53 of 1954 band pixels were missing in the
test scenario. 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.

Drawing issue when LineMode = lmBands

1 participant