Skip to content

Offer a switch to the unified diff in the compare editor - #2854

Draft
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:compare-switch-to-unified-diff
Draft

Offer a switch to the unified diff in the compare editor#2854
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:compare-switch-to-unified-diff

Conversation

@vogella

@vogella vogella commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The unified diff has a toolbar button to open the comparison side by side, but there was no way back: seeing the same comparison as a unified diff meant changing the preference and opening it again. The text merge viewer now contributes the counterpart action, so the two views can be switched in both directions.

The button appears only when the comparison can actually be shown as a unified diff. That is decided from the structure of the already computed compare result without reading any content, so a comparison without a workspace file to sit on keeps its toolbar clean. Switching reuses the prepared input rather than comparing again, and only the side that supplies the diff is read, in a job.

Once the unified diff is up the compare editor is closed, so a switch leaves one editor rather than two. That is deliberately not symmetric with the other direction, which leaves the text editor open; a text editor is a normal editor the user may still want, while a compare editor that has been replaced is just clutter. Worth a second opinion, which is one reason this is a draft.

Draft, and stacked on #2853: the fallback path relies on that PR closing the editor it opened. The icon is a placeholder I drew and would benefit from a real one.

Contributes to #2795

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ±0      54 suites  ±0   55m 24s ⏱️ - 3m 30s
 4 710 tests +3   4 688 ✅ +3   22 💤 ±0  0 ❌ ±0 
12 021 runs  +9  11 868 ✅ +9  153 💤 ±0  0 ❌ ±0 

Results for commit 2ed603c. ± Comparison against base commit 1cc9ae4.

♻️ This comment has been updated with latest results.

@vogella
vogella force-pushed the compare-switch-to-unified-diff branch from 77161b0 to b1276b1 Compare August 6, 2026 10:06
The unified diff has a toolbar button to open the comparison side by side,
but there was no way back: seeing the same comparison as a unified diff
meant changing the preference and opening it again.

The text merge viewer now contributes the counterpart action. It appears
only when the comparison can actually be shown as a unified diff, which is
decided from the structure of the already computed compare result without
reading any content, so a comparison without a workspace file to sit on
keeps its toolbar clean.

Switching reuses the prepared input rather than comparing again; only the
side that supplies the diff is read, and that happens in a job. Once the
unified diff is up the compare editor is closed, so a switch leaves one
editor rather than two. When the comparison has unsaved merge changes,
closing prompts as usual.
@vogella
vogella force-pushed the compare-switch-to-unified-diff branch from b1276b1 to 2ed603c Compare August 7, 2026 12:08
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.

1 participant