diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2019-07-04 14:49:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-04 14:49:25 +0300 |
commit | 1e8f6693382213216faab10624e87df8281027ae (patch) | |
tree | a9b97591d07085a86f962643448730868220f161 /main | |
parent | c847e38e437e427b68f8966cd39a409c4df8e712 (diff) | |
parent | a32460e2a044a06b17e7e8ba2d7b4d50208cd847 (diff) |
Merge pull request #8062 from mono/backport-pr-8061-to-release-8.2
[release-8.2] Fixes VSTS Bug 938343: [Feedback] Diff Option in Version Control not
Diffstat (limited to 'main')
-rw-r--r-- | main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs | 28 |
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); } } |