mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
enhance: remove invalid expanded node records in repository's settings
This commit is contained in:
parent
ec94c8c1b4
commit
7028e08390
2 changed files with 11 additions and 0 deletions
|
@ -58,6 +58,7 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
public List<BranchTreeNode> Locals => _locals;
|
public List<BranchTreeNode> Locals => _locals;
|
||||||
public List<BranchTreeNode> Remotes => _remotes;
|
public List<BranchTreeNode> Remotes => _remotes;
|
||||||
|
public List<string> InvalidExpandedNodes => _invalidExpandedNodes;
|
||||||
|
|
||||||
public void SetExpandedNodes(List<string> expanded)
|
public void SetExpandedNodes(List<string> expanded)
|
||||||
{
|
{
|
||||||
|
@ -98,6 +99,12 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var path in _expanded)
|
||||||
|
{
|
||||||
|
if (!folders.ContainsKey(path))
|
||||||
|
_invalidExpandedNodes.Add(path);
|
||||||
|
}
|
||||||
|
|
||||||
folders.Clear();
|
folders.Clear();
|
||||||
SortNodes(_locals);
|
SortNodes(_locals);
|
||||||
SortNodes(_remotes);
|
SortNodes(_remotes);
|
||||||
|
@ -188,6 +195,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
private readonly List<BranchTreeNode> _locals = new List<BranchTreeNode>();
|
private readonly List<BranchTreeNode> _locals = new List<BranchTreeNode>();
|
||||||
private readonly List<BranchTreeNode> _remotes = new List<BranchTreeNode>();
|
private readonly List<BranchTreeNode> _remotes = new List<BranchTreeNode>();
|
||||||
|
private readonly List<string> _invalidExpandedNodes = new List<string>();
|
||||||
private readonly HashSet<string> _expanded = new HashSet<string>();
|
private readonly HashSet<string> _expanded = new HashSet<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2088,6 +2088,9 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
builder.SetExpandedNodes(_settings.ExpandedBranchNodesInSideBar);
|
builder.SetExpandedNodes(_settings.ExpandedBranchNodesInSideBar);
|
||||||
builder.Run(branches, remotes, false);
|
builder.Run(branches, remotes, false);
|
||||||
|
|
||||||
|
foreach (var invalid in builder.InvalidExpandedNodes)
|
||||||
|
_settings.ExpandedBranchNodesInSideBar.Remove(invalid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue