From 5a1c9f57df6d575ecdbfe64120a1490ae422c7f2 Mon Sep 17 00:00:00 2001 From: Jamie Cansdale Date: Thu, 3 May 2018 09:24:26 +0100 Subject: [PATCH] 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 --- src/GitHub.App/Services/PullRequestEditorService.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/GitHub.App/Services/PullRequestEditorService.cs b/src/GitHub.App/Services/PullRequestEditorService.cs index 360fed5db0..9dc8d2a699 100644 --- a/src/GitHub.App/Services/PullRequestEditorService.cs +++ b/src/GitHub.App/Services/PullRequestEditorService.cs @@ -187,6 +187,17 @@ await pullRequestService.ExtractToTempFile( var diffViewer = GetDiffViewer(frame); + if (diffViewer.LeftView.TextBuffer.CurrentSnapshot.GetText() == string.Empty) + { + // Don't show LeftView when empty. + diffViewer.ViewMode = DifferenceViewMode.RightViewOnly; + } + else if (diffViewer.RightView.TextBuffer.CurrentSnapshot.GetText() == string.Empty) + { + // Don't show RightView when empty. + diffViewer.ViewMode = DifferenceViewMode.LeftViewOnly; + } + AddBufferTag(diffViewer.LeftView.TextBuffer, session, leftPath, mergeBase, DiffSide.Left); if (!workingDirectory)