Skip to content

Commit 356fb6f

Browse files
committed
fix: hotkey mismatch on macOS (#657)
Signed-off-by: leo <[email protected]>
1 parent 3e52dec commit 356fb6f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Views/Histories.axaml.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,15 @@ private void OnCommitListDoubleTapped(object sender, TappedEventArgs e)
722722

723723
private void OnCommitListKeyDown(object sender, KeyEventArgs e)
724724
{
725+
bool isSystemCmdKeyDown = (OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Meta)) ||
726+
(!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Control));
727+
if (!isSystemCmdKeyDown)
728+
return;
729+
725730
// These shortcuts are not mentioned in the Shortcut Reference window. Is this expected?
726-
if (sender is ListBox { SelectedItems: { Count: > 0 } selected } &&
727-
e.KeyModifiers.HasFlag(KeyModifiers.Control))
731+
if (sender is ListBox { SelectedItems: { Count: > 0 } selected })
728732
{
729-
// CTRL + C -> Copy selected commit SHA and subject.
733+
// CTRL/COMMAND + C -> Copy selected commit SHA and subject.
730734
if (e.Key == Key.C)
731735
{
732736
var builder = new StringBuilder();
@@ -741,7 +745,7 @@ private void OnCommitListKeyDown(object sender, KeyEventArgs e)
741745
return;
742746
}
743747

744-
// CTRL + B -> shows Create Branch pop-up at selected commit.
748+
// CTRL/COMMAND + B -> shows Create Branch pop-up at selected commit.
745749
if (e.Key == Key.B)
746750
{
747751
if (selected.Count == 1 &&

0 commit comments

Comments
 (0)