Skip to content

[win32] Resolve tab stops entirely in points in TextLayout.computeRuns() - #3495

Merged
vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:textlayout-tab-stops-cleanup
Oct 2, 2026
Merged

vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:textlayout-tab-stops-cleanup

Conversation

@vogella

@vogella vogella commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

The tab stop handling in TextLayout.computeRuns() mixes units: the stop is selected in points while the resulting position and the adjustment for merged consecutive tabs are accumulated from the pixel-converted stops. This keeps the whole computation in points and converts once, when the final position is known, so the pixel copy of the stops disappears and the merged-tab adjustment works on the same values as the lookup.

Besides being easier to follow, it removes a rounding drift: each step past the last tab stop currently rounds separately, so merged tabs can end a pixel away from the stop the caller defined. For example, three tabs with setTabs(new int[] {10}) end at 39 px instead of 38 px at 125% zoom.

@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Test Results (win32)

   35 files  ±0     35 suites  ±0   5m 24s ⏱️ +9s
4 953 tests +5  4 871 ✅ +5  82 💤 ±0  0 ❌ ±0 
1 476 runs  +5  1 449 ✅ +5  27 💤 ±0  0 ❌ ±0 

Results for commit e59aa0a. ± Comparison against base commit e526abd.

♻️ This comment has been updated with latest results.

@vogella
vogella force-pushed the textlayout-tab-stops-cleanup branch from 2cae3e0 to 2711be1 Compare September 30, 2026 13:03
@vogella
vogella marked this pull request as ready for review September 30, 2026 13:03
@vogella
vogella force-pushed the textlayout-tab-stops-cleanup branch 2 times, most recently from 5670f9b to e0956a9 Compare September 30, 2026 16:14
Since the fix for collapsed tab stops, the stop is selected in points,
but the adjustment for merged consecutive tabs still sums pixel-converted
stop widths. Past the last stop each extra tab adds the rounding error of
the last tab width again, so positions drift away from the stops the
caller defined.

Keep the whole computation in points and convert once, when the final
position is known. The exact space grid used for setDefaultTabWidth()
stays in pixels.

The degenerate case of a non-increasing tabs array now leaves the run at
its measured glyph advance rather than adding a non-positive stop delta.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella
vogella force-pushed the textlayout-tab-stops-cleanup branch from e0956a9 to e59aa0a Compare September 30, 2026 16:14
@vogella
vogella requested a balanced review from Copilot October 2, 2026 07:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The unit-consistent implementation is correct and covered by focused regression tests.

Review effort: Balanced
Findings: None

What changed in this PR

Keeps Win32 merged-tab calculations in points until final pixel conversion, eliminating HiDPI rounding drift.

Changes:

  • Resolves custom tab stops consistently in point units.
  • Adds multi-zoom regression coverage for merged tabs.
File Description
TextLayout.java Corrects merged-tab stop positioning.
TextLayoutWin32Tests.java Tests repeated stops across zoom levels.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vogella
vogella merged commit 9a5f59e into eclipse-platform:master Oct 2, 2026
16 checks passed
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