mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +00:00
feature: support using left/right arrow to expand/collapse tree node (#463)
This commit is contained in:
parent
01380ff194
commit
07cba1cf5f
5 changed files with 82 additions and 37 deletions
|
@ -25,6 +25,26 @@ namespace SourceGit.Views
|
|||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public class RepositoryListBox : ListBox
|
||||
{
|
||||
protected override Type StyleKeyOverride => typeof(ListBox);
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
if (SelectedItems is [ViewModels.RepositoryNode { IsRepository: false } node] && e.KeyModifiers == KeyModifiers.None)
|
||||
{
|
||||
if ((node.IsExpanded && e.Key == Key.Left) || (!node.IsExpanded && e.Key == Key.Right))
|
||||
{
|
||||
ViewModels.Welcome.Instance.ToggleNodeIsExpanded(node);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!e.Handled)
|
||||
base.OnKeyDown(e);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Welcome : UserControl
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue