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
path: root/main/src
diff options
context:
space:
mode:
authorSandy Armstrong <sandy@xamarin.com>2019-09-20 01:48:17 +0300
committerGitHub <noreply@github.com>2019-09-20 01:48:17 +0300
commitfda4e5644b56ced4c713d16e3ed4ea28bfeaa2c7 (patch)
tree565032c53392ade6cc3f037d29a8c025401b672e /main/src
parentcf53f2a296a1db22b1530f124df98042a9fbc007 (diff)
parenta996429c22d442897bba4c202afad62331edf78d (diff)
Merge pull request #8768 from mono/fix-984818
Fixes current navigation history and takes care about closed documents
Diffstat (limited to 'main/src')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/DocumentNavigationPoint.cs14
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs7
3 files changed, 28 insertions, 5 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 65d8e21269..abaaba3907 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 ()
@@ -128,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)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs
index 1347e3d21c..db28545b59 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskStore.cs
@@ -419,8 +419,11 @@ namespace MonoDevelop.Ide.Tasks
class TaskNavigationPoint : TextFileNavigationPoint
{
TaskListEntry task;
-
- public TaskNavigationPoint (TaskListEntry task) : base (task.FileName, task.Line, task.Column)
+
+ // Due to changes in the editor, the offsets of how we count lines seem to be different
+ // so it makes sense that we try to do translation at this point, where it doesn't change
+ // the logic in either <see cref="TextFileNavigationPoint"/> or in the TaskStore.
+ public TaskNavigationPoint (TaskListEntry task) : base (task.FileName, task.Line - 1, task.Column - 1)
{
this.task = task;
}