Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mikkrg@microsoft.com>2019-06-28 10:21:27 +0300
committerMike Krüger <mikkrg@microsoft.com>2019-07-01 16:36:16 +0300
commitfe663d2284bb82d882fa797ffeccd43243a25705 (patch)
tree51f941d48fa08031bd93c7ad60bd85de07d00b72 /main/src/addins/VersionControl
parent7adbba276a09d9680d44fa00fe3db93f2dfb251e (diff)
Fixes VSTS Bug 938343: [Feedback] Diff Option in Version Control not
working as expected. https://devdiv.visualstudio.com/DevDiv/_workitems/edit/938343
Diffstat (limited to 'main/src/addins/VersionControl')
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs28
1 files changed, 17 insertions, 11 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
index 5032fbd507..db1b4688fd 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
@@ -128,17 +128,23 @@ namespace MonoDevelop.VersionControl.Views
protected override void OnUnfocused ()
{
- var textView = info.Controller.GetContent <ITextView> ();
- if (textView != null) {
- var pos = ComparisonWidget.OriginalEditor.Caret.Offset;
- var snapshot = textView.TextSnapshot;
- var point = new SnapshotPoint (snapshot, Math.Max (0, Math.Min (snapshot.Length - 1, pos)));
- textView.Caret.MoveTo (point);
-
- int line = GetLineInCenter (ComparisonWidget.OriginalEditor);
- line = Math.Min (line, snapshot.LineCount);
- var middleLine = snapshot.GetLineFromLineNumber (line);
- textView.ViewScroller.EnsureSpanVisible (new SnapshotSpan (textView.TextSnapshot, middleLine.Start, 0), EnsureSpanVisibleOptions.AlwaysCenter);
+ try {
+ var textView = info.Controller.GetContent<ITextView> ();
+ if (textView != null) {
+ if (textView.IsClosed)
+ return;
+ var pos = ComparisonWidget.OriginalEditor.Caret.Offset;
+ var snapshot = textView.TextSnapshot;
+ var point = new SnapshotPoint (snapshot, Math.Max (0, Math.Min (snapshot.Length - 1, pos)));
+ textView.Caret.MoveTo (point);
+
+ int line = GetLineInCenter (ComparisonWidget.OriginalEditor);
+ line = Math.Min (line, snapshot.LineCount);
+ var middleLine = snapshot.GetLineFromLineNumber (line);
+ textView.ViewScroller.EnsureSpanVisible (new SnapshotSpan (textView.TextSnapshot, middleLine.Start, 0), EnsureSpanVisibleOptions.AlwaysCenter);
+ }
+ } catch (Exception e) {
+ LoggingService.LogInternalError (e);
}
}