From 33b7094d8fe91f117abcc4abdcad8412ebe46f5b Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Fri, 8 May 2020 15:56:17 +0900 Subject: [PATCH] fix: arrow keys shortcuts for right-to-left languages --- src/ui/main-window/ThumbnailsView.swift | 6 ++++++ src/ui/preferences-window/tabs/GeneralTab.swift | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ui/main-window/ThumbnailsView.swift b/src/ui/main-window/ThumbnailsView.swift index 7817b8ba..24d0932e 100644 --- a/src/ui/main-window/ThumbnailsView.swift +++ b/src/ui/main-window/ThumbnailsView.swift @@ -165,6 +165,8 @@ enum Direction { case neutral case left case right + case leading + case trailing case up case down @@ -173,6 +175,10 @@ enum Direction { return -1 } else if self == .right { return 1 + } else if self == .leading { + return App.shared.userInterfaceLayoutDirection == .leftToRight ? 1 : -1 + } else if self == .trailing { + return App.shared.userInterfaceLayoutDirection == .leftToRight ? -1 : 1 } return 0 } diff --git a/src/ui/preferences-window/tabs/GeneralTab.swift b/src/ui/preferences-window/tabs/GeneralTab.swift index c59ae509..29af9d08 100644 --- a/src/ui/preferences-window/tabs/GeneralTab.swift +++ b/src/ui/preferences-window/tabs/GeneralTab.swift @@ -13,8 +13,8 @@ class GeneralTab: NSViewController, PreferencePane { "holdShortcut": { App.app.focusTarget() }, "nextWindowShortcut": { App.app.showUiOrCycleSelection(.right) }, "previousWindowShortcut": { App.app.showUiOrCycleSelection(.left) }, - "→": { App.app.cycleSelection(.right) }, - "←": { App.app.cycleSelection(.left) }, + "→": { App.app.cycleSelection(.leading) }, + "←": { App.app.cycleSelection(.trailing) }, "↑": { App.app.cycleSelection(.up) }, "↓": { App.app.cycleSelection(.down) }, "cancelShortcut": { App.app.hideUi() },