ux: keybindings for BranchSelector

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2026-04-02 15:06:02 +08:00
parent 26ab0a7529
commit 8ec1527fe6

View File

@@ -158,6 +158,30 @@ namespace SourceGit.Views
listBox?.Focus();
e.Handled = true;
}
else if (e.Key == Key.Up)
{
var listBox = _popup?.Child?.FindDescendantOfType<ListBox>();
if (listBox != null)
{
if (listBox.SelectedIndex > 0)
listBox.SelectedIndex--;
listBox.Focus();
}
e.Handled = true;
}
else if (e.Key == Key.Down)
{
var listBox = _popup?.Child?.FindDescendantOfType<ListBox>();
if (listBox != null)
{
if (listBox.SelectedIndex < listBox.Items.Count - 1)
listBox.SelectedIndex++;
listBox.Focus();
}
e.Handled = true;
}
}
private void OnClearSearchFilter(object sender, RoutedEventArgs e)
@@ -173,6 +197,17 @@ namespace SourceGit.Views
IsDropDownOpened = false;
e.Handled = true;
}
else if (e.Key == Key.F && e.KeyModifiers == (OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control))
{
var searchBox = _popup?.Child?.FindDescendantOfType<TextBox>();
if (searchBox != null)
{
searchBox.CaretIndex = SearchFilter?.Length ?? 0;
searchBox.Focus();
}
e.Handled = true;
}
}
private void OnDropDownItemPointerPressed(object sender, PointerPressedEventArgs e)