mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-24 02:40:24 +08:00
enhance: allow to use arrow up/down to select workspace/tab after switcher popups (#1711)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -32,14 +32,28 @@ namespace SourceGit.Views
|
||||
|
||||
private void OnSearchBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Down && PagesListBox.ItemCount > 0)
|
||||
if (PagesListBox.ItemCount == 0)
|
||||
return;
|
||||
|
||||
if (e.Key == Key.Down)
|
||||
{
|
||||
PagesListBox.Focus(NavigationMethod.Directional);
|
||||
|
||||
if (PagesListBox.SelectedIndex < 0)
|
||||
PagesListBox.SelectedIndex = 0;
|
||||
else if (PagesListBox.SelectedIndex < PagesListBox.ItemCount)
|
||||
if (PagesListBox.SelectedIndex < PagesListBox.ItemCount - 1)
|
||||
PagesListBox.SelectedIndex++;
|
||||
else
|
||||
PagesListBox.SelectedIndex = 0;
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
else if (e.Key == Key.Up)
|
||||
{
|
||||
PagesListBox.Focus(NavigationMethod.Directional);
|
||||
|
||||
if (PagesListBox.SelectedIndex > 0)
|
||||
PagesListBox.SelectedIndex--;
|
||||
else
|
||||
PagesListBox.SelectedIndex = PagesListBox.ItemCount - 1;
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
@@ -32,14 +32,28 @@ namespace SourceGit.Views
|
||||
|
||||
private void OnSearchBoxKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Down && WorkspaceListBox.ItemCount > 0)
|
||||
if (WorkspaceListBox.ItemCount == 0)
|
||||
return;
|
||||
|
||||
if (e.Key == Key.Down)
|
||||
{
|
||||
WorkspaceListBox.Focus(NavigationMethod.Directional);
|
||||
|
||||
if (WorkspaceListBox.SelectedIndex < 0)
|
||||
WorkspaceListBox.SelectedIndex = 0;
|
||||
else if (WorkspaceListBox.SelectedIndex < WorkspaceListBox.ItemCount)
|
||||
if (WorkspaceListBox.SelectedIndex < WorkspaceListBox.ItemCount - 1)
|
||||
WorkspaceListBox.SelectedIndex++;
|
||||
else
|
||||
WorkspaceListBox.SelectedIndex = 0;
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
else if (e.Key == Key.Up)
|
||||
{
|
||||
WorkspaceListBox.Focus(NavigationMethod.Directional);
|
||||
|
||||
if (WorkspaceListBox.SelectedIndex > 0)
|
||||
WorkspaceListBox.SelectedIndex--;
|
||||
else
|
||||
WorkspaceListBox.SelectedIndex = WorkspaceListBox.ItemCount - 1;
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user