mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-17 00:14:59 +00:00
feature: support delete key everywhere (#1412)
This commit is contained in:
parent
5494093261
commit
196b454ae8
11 changed files with 127 additions and 11 deletions
|
@ -1,4 +1,5 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -33,6 +34,21 @@ namespace SourceGit.Views
|
|||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnStashKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key is not (Key.Delete or Key.Back))
|
||||
return;
|
||||
|
||||
if (DataContext is not ViewModels.StashesPage vm)
|
||||
return;
|
||||
|
||||
if (sender is not ListBox { SelectedValue: Models.Stash stash })
|
||||
return;
|
||||
|
||||
vm.Drop(stash);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnChangeContextRequested(object sender, ContextRequestedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.StashesPage vm && sender is Grid grid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue