Offer a switch to the unified diff in the compare editor - #2854
Draft
vogella wants to merge 1 commit into
Draft
Conversation
Contributor
vogella
force-pushed
the
compare-switch-to-unified-diff
branch
from
August 6, 2026 10:06
77161b0 to
b1276b1
Compare
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
force-pushed
the
compare-switch-to-unified-diff
branch
from
August 7, 2026 12:08
b1276b1 to
2ed603c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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