diff options
author | Jose Medrano <josmed@microsoft.com> | 2019-09-18 14:41:56 +0300 |
---|---|---|
committer | Jose Medrano <josmed@microsoft.com> | 2019-09-18 14:41:56 +0300 |
commit | 50bd3061624fca019405dfeeaec47d2fc153b389 (patch) | |
tree | 319b96d1bd1444798daf33183020c8b716dd45d9 /main | |
parent | baba2fc9a7ff402b8193c42696d1ecb38fcfd7e6 (diff) |
Fixes current line and column in TextFileNavigationPoint
Fixes VSTS #984818 - "Navigate Back" shorcut it's not working correctly
Diffstat (limited to 'main')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs index 65d8e21269..d8536e4ded 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs @@ -53,6 +53,16 @@ namespace MonoDevelop.Ide.Navigation : base (doc) { offset = textView.Caret.Position.BufferPosition; + RefreshWithCurrentOffset (textView); + } + + void RefreshWithCurrentOffset (ITextView textView) + { + if (textView != null && offset.HasValue) { + var currentLine = textView.TextBuffer.CurrentSnapshot.GetLineFromPosition (offset.Value); + line = currentLine.LineNumber; + column = offset.Value.Position - currentLine.Start.Position; + } } protected override void OnDocumentClosing () |