Skip to content

Commit 3948d43

Browse files
committed
Track active document fixes.
- Try to resync on project opening. - If the node for the file is not found, try to find it in the future. This can happen with files created through wizards. I don't think this has any negative impact on files outside of the project, the check is quite simple and only happens on file changes.
1 parent 2ca18af commit 3948d43

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

External/Plugins/ProjectManager/PluginMain.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,9 @@ void SetProject(Project project, Boolean stealFocus, Boolean internalOpening)
647647
RestoreProjectSession(project);
648648
}
649649

650+
// track active file
651+
if (Settings.TrackActiveDocument) TreeSyncToCurrentFile();
652+
650653
if (stealFocus)
651654
{
652655
OpenPanel();
@@ -1629,8 +1632,19 @@ private void TreeSyncToCurrentFile()
16291632
ITabbedDocument doc = PluginBase.MainForm.CurrentDocument;
16301633
if (activeProject != null && doc != null && doc.IsEditable && !doc.IsUntitled)
16311634
{
1632-
Tree.Select(doc.FileName);
1633-
Tree.SelectedNode.EnsureVisible();
1635+
string path = doc.FileName;
1636+
1637+
if (Tree.SelectedNode != null && Tree.SelectedNode.BackingPath == path)
1638+
return;
1639+
1640+
Tree.Select(path);
1641+
if (Tree.SelectedNode.BackingPath == path)
1642+
{
1643+
Tree.SelectedNode.EnsureVisible();
1644+
Tree.PathToSelect = null;
1645+
}
1646+
else
1647+
Tree.PathToSelect = path;
16341648
}
16351649
}
16361650

0 commit comments

Comments
 (0)