From 213f04a57b9fe00d755301880de8de87008f2ab5 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 9 Mar 2024 20:58:00 +0800 Subject: [PATCH] fix: branch tree not restore last IsExpanded nodes. See issue #20 * Binding IsExpanded property of TreeViewItem with Models.BranchTreeNode * Current local branch should never be collapsed --- src/Models/BranchTreeNode.cs | 4 ++-- src/Views/Repository.axaml | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Models/BranchTreeNode.cs b/src/Models/BranchTreeNode.cs index f2e1da63..77236e4c 100644 --- a/src/Models/BranchTreeNode.cs +++ b/src/Models/BranchTreeNode.cs @@ -114,7 +114,7 @@ namespace SourceGit.Models { lastFolder = new BranchTreeNode() { Name = subs[i], Type = BranchTreeNodeType.Folder, - IsExpanded = _expanded.Contains(path), + IsExpanded = branch.IsCurrent || _expanded.Contains(path), }; roots.Add(lastFolder); _maps.Add(path, lastFolder); @@ -122,7 +122,7 @@ namespace SourceGit.Models { var folder = new BranchTreeNode() { Name = subs[i], Type = BranchTreeNodeType.Folder, - IsExpanded = _expanded.Contains(path), + IsExpanded = branch.IsCurrent || _expanded.Contains(path), }; _maps.Add(path, folder); lastFolder.Children.Add(folder); diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index e5739189..83504a54 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -161,6 +161,11 @@ ScrollViewer.VerticalScrollBarVisibility="Auto" LostFocus="OnLocalBranchTreeLostFocus" SelectionChanged="OnLocalBranchTreeSelectionChanged"> + + + @@ -208,6 +213,12 @@ ScrollViewer.VerticalScrollBarVisibility="Auto" LostFocus="OnRemoteBranchTreeLostFocus" SelectionChanged="OnRemoteBranchTreeSelectionChanged"> + + + +