fix: OnNodesSelectionChanged event should not be disabled while auto-selecting current branch (#1022)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-06-24 18:15:26 +08:00
parent 4c4d8ae031
commit 00ccf29b2b
No known key found for this signature in database

View file

@ -246,16 +246,11 @@ namespace SourceGit.Views
if (branch == null)
return;
_disableSelectionChangingEvent = true;
var treePath = new List<ViewModels.BranchTreeNode>();
FindTreePath(treePath, Nodes, branch.Name, 0);
if (treePath.Count == 0)
{
_disableSelectionChangingEvent = false;
return;
}
var oldRowCount = Rows.Count;
var rows = Rows;
@ -276,7 +271,6 @@ namespace SourceGit.Views
var target = treePath[treePath.Count - 1];
BranchesPresenter.SelectedItem = target;
BranchesPresenter.ScrollIntoView(target);
_disableSelectionChangingEvent = false;
if (oldRowCount != rows.Count)
RaiseEvent(new RoutedEventArgs(RowsChangedEvent));