Skip to content

Render whitespace glyphs in unified-diff code minings and overlay - #2998

Open
tobiasmelcher wants to merge 1 commit into
eclipse-platform:masterfrom
tobiasmelcher:d031119/whitespace-glyphs-unified-diff
Open

tobiasmelcher wants to merge 1 commit into
eclipse-platform:masterfrom
tobiasmelcher:d031119/whitespace-glyphs-unified-diff

Conversation

@tobiasmelcher

Copy link
Copy Markdown
Contributor

Fixes #2942

When "Show Whitespace Characters" is enabled, the unified-diff deletion and addition code minings now render whitespace as visible glyphs at the configured alpha, matching the editor text drawn by WhitespaceCharacterPainter:

  • spaces as ·, the ideographic space (U+3000) as °
  • tabs as a single » on the first column of the expanded tab run
  • ¤/ line delimiters at the end of filled lines

The leading/enclosed/trailing (and ideographic) visibility flags are honored as the editor does, including on all-whitespace lines where any of the three flags shows the run.

Because the label is kept tab-expanded for layout, the glyph substitution learns from the raw line which expanded columns originate from a tab. The click-through overlay opened on a mining keeps the original tabs in its document and lets the real WhitespaceCharacterPainter render them.

The global whitespace settings are read once and cached, invalidated by a preference-store listener, instead of being re-read on every paint of every mining.


Developed with assistance from Claude Code.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ± 0      54 suites  ±0   34m 26s ⏱️ +14s
 4 889 tests +17   4 867 ✅ +17   22 💤 ±0  0 ❌ ±0 
12 558 runs  +51  12 404 ✅ +51  154 💤 ±0  0 ❌ ±0 

Results for commit 691da63. ± Comparison against base commit ea81a95.

♻️ This comment has been updated with latest results.

@tobiasmelcher
tobiasmelcher force-pushed the d031119/whitespace-glyphs-unified-diff branch from 488fb3b to 34df500 Compare October 9, 2026 14:34
@tobiasmelcher

Copy link
Copy Markdown
Contributor Author

@HannesWell it would be great if you could review and test this change by end of next week. I'll be on vacation then and plan to merge once I'm back.

@tobiasmelcher
tobiasmelcher force-pushed the d031119/whitespace-glyphs-unified-diff branch 2 times, most recently from c74acfb to 64ed3ea Compare October 19, 2026 17:09
@tobiasmelcher
tobiasmelcher force-pushed the d031119/whitespace-glyphs-unified-diff branch from 64ed3ea to 691da63 Compare October 19, 2026 17:09
@tobiasmelcher

Copy link
Copy Markdown
Contributor Author

Hi @HannesWell, just a friendly reminder: unless I hear any objections, I plan to merge this tomorrow. Thanks!

@HannesWell

Copy link
Copy Markdown
Member

Thank you for working on this Tobias and sorry for the delayed reply. The last one/two weeks were very busy for me with tasks outside the Eclipse realm.

In general this looks good but it seems that whitespace diffs are not handled correctly.
Given the following two files:
grafik

The unified Diff misses the differences in the 'blank' line and it misses the line break at the end of the 'removed' line:

grafik

Maybe it's related that I'm on Windows (as the line break markers indicate)?

Furthermore I'm surprised that this change requires that much code. And without being familiar with this part of the code, I wonder if this could be done simpler?
Or if this really requires so much effort, then I wonder if it would be better to implement this in general for code-minings/'ghost-text' so that eventually the unified diff would (in my simplified understanding) just have to pass an option like 'show withe space characters'.

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.

Unified Diff: Whitespace rendering missing in deletion areas

2 participants