Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 5a1c9f5

Browse files
committed
Hide diff view sides when empty
When diff LeftView is empty, automatically set to show RightViewOnly. When diff RightView is empty, automatically set to show LeftViewOnly. Fixes #1624
1 parent 36e680e commit 5a1c9f5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/GitHub.App/Services/PullRequestEditorService.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,17 @@ await pullRequestService.ExtractToTempFile(
187187

188188
var diffViewer = GetDiffViewer(frame);
189189

190+
if (diffViewer.LeftView.TextBuffer.CurrentSnapshot.GetText() == string.Empty)
191+
{
192+
// Don't show LeftView when empty.
193+
diffViewer.ViewMode = DifferenceViewMode.RightViewOnly;
194+
}
195+
else if (diffViewer.RightView.TextBuffer.CurrentSnapshot.GetText() == string.Empty)
196+
{
197+
// Don't show RightView when empty.
198+
diffViewer.ViewMode = DifferenceViewMode.LeftViewOnly;
199+
}
200+
190201
AddBufferTag(diffViewer.LeftView.TextBuffer, session, leftPath, mergeBase, DiffSide.Left);
191202

192203
if (!workingDirectory)

0 commit comments

Comments
 (0)