Skip to content

Keep the height reserved by a code mining in sync with the font - #4238

Merged
vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:codemining-font-change
Aug 14, 2026
Merged

Keep the height reserved by a code mining in sync with the font#4238
vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:codemining-font-change

Conversation

@vogella

@vogella vogella commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

A line header annotation reserves its vertical space while it is painted, so an annotation that is out of view keeps the space of the font it was last painted with. When the user changes the text size, only the lines still in view take the new size and everything else keeps the old spacing until it is scrolled into view. This is visible in any editor with multi-line line header minings, and it is what makes the experimental unified diff overlay update only partially on a zoom.

InlinedAnnotationSupport now refreshes the reserved height of every line header annotation that already reserves space when the font of the text widget changes. SWT reports no font change, so it is noticed on the redraw that the change triggers, and lines that never reserved space keep reserving it lazily on their first paint as before.

The new test in CodeMiningTest fails without the fix, with line 5 still reserving 19 pixels after the line height grew to 37.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Test Results

   858 files     858 suites   53m 10s ⏱️
 8 161 tests  7 918 ✅ 243 💤 0 ❌
20 385 runs  19 731 ✅ 654 💤 0 ❌

Results for commit 80c3cf6.

♻️ This comment has been updated with latest results.

@vogella
vogella force-pushed the codemining-font-change branch 2 times, most recently from bc1e772 to 6f9bb4c Compare August 13, 2026 06:26

@tobiasmelcher tobiasmelcher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot Lars for providing the fix.

@vogella
vogella force-pushed the codemining-font-change branch from 6f9bb4c to 2156451 Compare August 13, 2026 20:19
A line header annotation reserves its vertical space while it is painted,
so an annotation that is out of view keeps the space of the font it was
last painted with. After the user changes the text size only the lines
still in view take the new size, while the rest keeps the old spacing
until something paints them again.

Refresh the reserved height of every line header annotation that already
reserves space when the line height of the text widget changes. SWT
reports no font change, so it is noticed on the redraw the change
triggers, comparing the line height rather than holding on to a font the
editor disposes right after applying it.
@vogella
vogella force-pushed the codemining-font-change branch from 2156451 to 80c3cf6 Compare August 14, 2026 05:58
@vogella
vogella merged commit 6cb2a35 into eclipse-platform:master Aug 14, 2026
18 checks passed
@vogella
vogella deleted the codemining-font-change branch August 14, 2026 09:56
@vogella

vogella commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @tobiasmelcher for the review

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.

2 participants