diff options
author | Jose Medrano <josmed@microsoft.com> | 2019-09-18 19:25:26 +0300 |
---|---|---|
committer | Jose Medrano <josmed@microsoft.com> | 2019-09-18 20:03:08 +0300 |
commit | 38a7cf5f8494027e68d6782b152ef206a7f74d7a (patch) | |
tree | ecf269f0c45fdcb0e962ca61a0381ab05b0f00b2 /main/src/core/MonoDevelop.Ide | |
parent | 50bd3061624fca019405dfeeaec47d2fc153b389 (diff) |
Fixes focus navigation history when document is closed
Diffstat (limited to 'main/src/core/MonoDevelop.Ide')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs | 14 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs index 86d04a99a4..113cb290fa 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs @@ -48,13 +48,16 @@ namespace MonoDevelop.Ide.Navigation FilePath fileName; string project; + bool isDocument; + public DocumentNavigationPoint (Document doc) { + isDocument = true; SetDocument (doc); } protected void SetDocument (Document doc) - {
+ { this.doc = doc; doc.Closed += HandleClosed; } @@ -113,7 +116,14 @@ namespace MonoDevelop.Ide.Navigation break; } } - return await IdeApp.Workbench.OpenDocument (new FileOpenInformation (fileName, p, true)); + + //in case the document was reopened we want to set again + var document = await IdeApp.Workbench.OpenDocument (new FileOpenInformation (fileName, p, true)); + if (isDocument) { + SetDocument (document); + } + + return document; } public override string DisplayName { 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 d8536e4ded..abaaba3907 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs @@ -138,7 +138,7 @@ namespace MonoDevelop.Ide.Navigation protected void JumpToCurrentLocation (ITextView textView) { - textView.NavigateToLineAndColumn (Math.Max (0, Line - 1), Math.Max (0, Column - 1)); + textView.NavigateToLineAndColumn (Math.Max (0, Line), Math.Max (0, Column)); } public override bool Equals (object o) |