feature: add hotkeys to stashes page

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2025-07-09 12:57:11 +08:00
parent 23e578f355
commit 7c59183391
3 changed files with 40 additions and 29 deletions

View File

@@ -78,8 +78,11 @@ namespace SourceGit.ViewModels
Dispatcher.UIThread.Post(() =>
{
_untracked = untracked;
Changes = changes;
if (value.SHA.Equals(_selectedStash?.SHA ?? string.Empty, StringComparison.Ordinal))
{
_untracked = untracked;
Changes = changes;
}
});
});
}
@@ -139,9 +142,6 @@ namespace SourceGit.ViewModels
public ContextMenu MakeContextMenu(Models.Stash stash)
{
if (stash == null)
return null;
var apply = new MenuItem();
apply.Header = App.Text("StashCM.Apply");
apply.Icon = App.CreateMenuIcon("Icons.CheckCircled");
@@ -154,6 +154,7 @@ namespace SourceGit.ViewModels
var drop = new MenuItem();
drop.Header = App.Text("StashCM.Drop");
drop.Icon = App.CreateMenuIcon("Icons.Clear");
drop.Tag = "Back/Delete";
drop.Click += (_, ev) =>
{
Drop(stash);
@@ -197,6 +198,7 @@ namespace SourceGit.ViewModels
var copy = new MenuItem();
copy.Header = App.Text("StashCM.CopyMessage");
copy.Icon = App.CreateMenuIcon("Icons.Copy");
copy.Tag = OperatingSystem.IsMacOS() ? "⌘+C" : "Ctrl+C";
copy.Click += async (_, ev) =>
{
await App.CopyTextAsync(stash.Message);
@@ -308,13 +310,13 @@ namespace SourceGit.ViewModels
public void Apply(Models.Stash stash)
{
if (stash != null && _repo.CanCreatePopup())
if (_repo.CanCreatePopup())
_repo.ShowPopup(new ApplyStash(_repo, stash));
}
public void Drop(Models.Stash stash)
{
if (stash != null && _repo.CanCreatePopup())
if (_repo.CanCreatePopup())
_repo.ShowPopup(new DropStash(_repo, stash));
}