mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-24 02:40:24 +08:00
enhance: double tap stash to apply (#1546)
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
ItemsSource="{Binding VisibleStashes}"
|
||||
SelectedItem="{Binding SelectedStash, Mode=TwoWay}"
|
||||
SelectionMode="Single"
|
||||
DoubleTapped="OnStashListDoubleTapped"
|
||||
KeyDown="OnStashListKeyDown"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto">
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user