Skip to content

Fix change highlight placement in TextMergeViewer after zoom change#2595

Open
HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
HeikoKlare:textmergeviewer-zoomchange-lineheights
Open

Fix change highlight placement in TextMergeViewer after zoom change#2595
HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
HeikoKlare:textmergeviewer-zoomchange-lineheights

Conversation

@HeikoKlare
Copy link
Copy Markdown
Contributor

The TextMergeViewer caches line heights for painting the change region highlights. That cache is not invalidated upon a zoom change even though the cached line heights are only valid for one specific zoom. In consequence, the highlights are not properly placed after a zoom change anymore.

This change clears the line height cached upon zoom change of the according canvas, which fixes the placement of change highlight regions after zoom changes.

How to test

Just open a text compare viewer and move it between monitors of different zooms on Windows.
For example when moving from 125% to 100%, it looks like this:

Before

image

After

image

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 26, 2026

Test Results

    54 files  ±0      54 suites  ±0   38m 27s ⏱️ +53s
 4 546 tests ±0   4 522 ✅  - 1   23 💤 ±0  1 ❌ +1 
12 234 runs  ±0  12 074 ✅  - 1  159 💤 ±0  1 ❌ +1 

For more details on these failures, see this check.

Results for commit 4f1b7ef. ± Comparison against base commit 4d9d68a.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes incorrect placement of change-region highlights in TextMergeViewer after a Windows per-monitor zoom/DPI change by invalidating the cached line-height data when a zoom change occurs.

Changes:

  • Adds an SWT.ZoomChanged listener to each StyledText to clear the line-height cache on zoom changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HeikoKlare HeikoKlare force-pushed the textmergeviewer-zoomchange-lineheights branch from 807c4b9 to 64f2c54 Compare March 27, 2026 10:48
The TextMergeViewer caches line heights for painting the change region
highlights. That cache is not invalidated upon a zoom change even though
the cached line heights are only valid for one specific zoom. In
consequence, the highlights are not properly placed after a zoom change
anymore.

This change clears the line height cached upon zoom change of the
according canvas, which fixes the placement of change highlight regions
after zoom changes.
@HeikoKlare HeikoKlare force-pushed the textmergeviewer-zoomchange-lineheights branch from 64f2c54 to 4f1b7ef Compare March 27, 2026 10:50
@HeikoKlare HeikoKlare requested a review from Copilot March 27, 2026 10:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HeikoKlare HeikoKlare requested a review from fedejeanne March 27, 2026 14:17
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.

Wrong positioning of change highlights in TextMergeViewer after zoom change

2 participants