From 22339ab61900a33e50804e6f1ac8dd2156154f0e Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 24 May 2025 21:29:48 +0800 Subject: [PATCH] enhance: allow to use arrow keys to select changes up/down after stage/unstage previous selected changes by hotkey (#1361) Signed-off-by: leo --- src/Views/ChangeCollectionView.axaml | 9 ++++++--- src/Views/ChangeCollectionView.axaml.cs | 8 ++++++++ src/Views/WorkingCopy.axaml | 2 -- src/Views/WorkingCopy.axaml.cs | 12 ++++++------ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/Views/ChangeCollectionView.axaml b/src/Views/ChangeCollectionView.axaml index 805028d0..36de5685 100644 --- a/src/Views/ChangeCollectionView.axaml +++ b/src/Views/ChangeCollectionView.axaml @@ -30,7 +30,8 @@ - @@ -66,7 +67,8 @@ - @@ -98,7 +100,8 @@ - diff --git a/src/Views/ChangeCollectionView.axaml.cs b/src/Views/ChangeCollectionView.axaml.cs index 6ef79861..00499fce 100644 --- a/src/Views/ChangeCollectionView.axaml.cs +++ b/src/Views/ChangeCollectionView.axaml.cs @@ -145,6 +145,7 @@ namespace SourceGit.Views removeCount++; } + tree.Rows.RemoveRange(idx + 1, removeCount); } } @@ -209,6 +210,13 @@ namespace SourceGit.Views return null; } + public void TakeFocus() + { + var container = this.FindDescendantOfType(); + if (container is { IsFocused: false }) + container.Focus(); + } + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) { base.OnPropertyChanged(change); diff --git a/src/Views/WorkingCopy.axaml b/src/Views/WorkingCopy.axaml index f905f4b5..ee8619f3 100644 --- a/src/Views/WorkingCopy.axaml +++ b/src/Views/WorkingCopy.axaml @@ -122,7 +122,6 @@