mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
code_review: PR #657
* add hotkey `Ctrl+Down/⌘+Down` to fetch directly * keep translation keys of en_US in order * add translations for zh_CN and zh_TW * do NOT using namespace under `SourceGit` * use `⇧` instead of `Shift` in hotkey tips * hotkey mismatch on macOS * hotkeys to start fetch/pull/push directly not work on macOS * remove the hotkey of `Create Branch` context menu item - there are other objects (such as branch and tag) also have the `Create Branch` context menu item without hotkeys - on macOS, we already use `⌘+B` to create branch with selected commit, not `Ctrl + B` Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
dc49c1bf76
commit
d50b2c0298
10 changed files with 84 additions and 49 deletions
|
@ -12,7 +12,6 @@ using Avalonia.Interactivity;
|
|||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using Avalonia.VisualTree;
|
||||
using SourceGit.ViewModels;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -723,11 +722,15 @@ namespace SourceGit.Views
|
|||
|
||||
private void OnCommitListKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
bool isSystemCmdKeyDown = (OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Meta)) ||
|
||||
(!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Control));
|
||||
if (!isSystemCmdKeyDown)
|
||||
return;
|
||||
|
||||
// These shortcuts are not mentioned in the Shortcut Reference window. Is this expected?
|
||||
if (sender is ListBox { SelectedItems: { Count: > 0 } selected } &&
|
||||
e.KeyModifiers.HasFlag(KeyModifiers.Control))
|
||||
if (sender is ListBox { SelectedItems: { Count: > 0 } selected })
|
||||
{
|
||||
// CTRL + C -> Copy selected commit SHA and subject.
|
||||
// CTRL/COMMAND + C -> Copy selected commit SHA and subject.
|
||||
if (e.Key == Key.C)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
|
@ -742,17 +745,16 @@ namespace SourceGit.Views
|
|||
return;
|
||||
}
|
||||
|
||||
// CTRL + B -> shows Create Branch pop-up at selected commit.
|
||||
// CTRL/COMMAND + B -> shows Create Branch pop-up at selected commit.
|
||||
if (e.Key == Key.B)
|
||||
{
|
||||
if (selected.Count == 1 &&
|
||||
selected[0] is Models.Commit commit &&
|
||||
DataContext is ViewModels.Histories histories &&
|
||||
PopupHost.CanCreatePopup())
|
||||
ViewModels.PopupHost.CanCreatePopup())
|
||||
{
|
||||
PopupHost.ShowPopup(new ViewModels.CreateBranch(histories.Repo, commit));
|
||||
ViewModels.PopupHost.ShowPopup(new ViewModels.CreateBranch(histories.Repo, commit));
|
||||
e.Handled = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue