enhance: double tap stash to apply (#1546)

This commit is contained in:
Nathan Baulch
2025-07-09 14:02:26 +10:00
committed by GitHub
parent 4b05cf15bf
commit 23e578f355
3 changed files with 18 additions and 6 deletions

View File

@@ -147,9 +147,7 @@ namespace SourceGit.ViewModels
apply.Icon = App.CreateMenuIcon("Icons.CheckCircled");
apply.Click += (_, ev) =>
{
if (_repo.CanCreatePopup())
_repo.ShowPopup(new ApplyStash(_repo, stash));
Apply(stash);
ev.Handled = true;
};
@@ -158,9 +156,7 @@ namespace SourceGit.ViewModels
drop.Icon = App.CreateMenuIcon("Icons.Clear");
drop.Click += (_, ev) =>
{
if (_repo.CanCreatePopup())
_repo.ShowPopup(new DropStash(_repo, stash));
Drop(stash);
ev.Handled = true;
};
@@ -310,6 +306,12 @@ namespace SourceGit.ViewModels
SearchFilter = string.Empty;
}
public void Apply(Models.Stash stash)
{
if (stash != null && _repo.CanCreatePopup())
_repo.ShowPopup(new ApplyStash(_repo, stash));
}
public void Drop(Models.Stash stash)
{
if (stash != null && _repo.CanCreatePopup())

View File

@@ -65,6 +65,7 @@
ItemsSource="{Binding VisibleStashes}"
SelectedItem="{Binding SelectedStash, Mode=TwoWay}"
SelectionMode="Single"
DoubleTapped="OnStashListDoubleTapped"
KeyDown="OnStashListKeyDown"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto">

View File

@@ -23,6 +23,15 @@ namespace SourceGit.Views
layout.StashesLeftWidth = new GridLength(maxLeft, GridUnitType.Pixel);
}
private void OnStashListDoubleTapped(object _, TappedEventArgs e)
{
if (DataContext is not ViewModels.StashesPage vm)
return;
vm.Apply(vm.SelectedStash);
e.Handled = true;
}
private void OnStashListKeyDown(object sender, KeyEventArgs e)
{
if (e.Key is not (Key.Delete or Key.Back))