Skip to content

Commit

Permalink
Handle Ctrl+Left/Right keys properly to switch tabs.
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster620 committed Feb 13, 2024
1 parent 88be9c0 commit b8e4bac
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions PixelViewer/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,25 @@ void OnPreviewKeyDown(object? sender, KeyEventArgs e)
{
switch (e.Key)
{
case Key.Left:
if (this.mainTabControl.SelectedIndex > 0)
--this.mainTabControl.SelectedIndex;
else if (this.mainTabItems.Count > 1)
this.mainTabControl.SelectedIndex = this.mainTabItems.Count - 2;
e.Handled = true;
break;
case Key.N:
if (Platform.IsNotMacOS) // Will be triggered through NativeMenu on macOS
this.CreateMainWindow();
e.Handled = true;
break;
case Key.Right:
if (this.mainTabControl.SelectedIndex < this.mainTabItems.Count - 2)
++this.mainTabControl.SelectedIndex;
else if (this.mainTabItems.Count > 1)
this.mainTabControl.SelectedIndex = 0;
e.Handled = true;
break;
case Key.T:
if (Platform.IsNotMacOS) // Will be triggered through NativeMenu on macOS
this.CreateMainTabItem();
Expand Down

0 comments on commit b8e4bac

Please sign in to comment.