From fcdf40a03ce3193343ea7e5239a5b3817be66a7c Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Fri, 7 Aug 2020 04:44:20 +0900 Subject: [PATCH] fix: removing shortcut 2 was not working properly (see #493) --- src/ui/preferences-window/tabs/ControlsTab.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/preferences-window/tabs/ControlsTab.swift b/src/ui/preferences-window/tabs/ControlsTab.swift index e83228fa..cefb124f 100644 --- a/src/ui/preferences-window/tabs/ControlsTab.swift +++ b/src/ui/preferences-window/tabs/ControlsTab.swift @@ -132,7 +132,11 @@ class ControlsTab: NSViewController, PreferencePane { if controlId == "nextWindowShortcut" || controlId == "nextWindowShortcut2" { let holdShortcut = controlId == "nextWindowShortcut" ? Preferences.holdShortcut : Preferences.holdShortcut2 // remove the holdShortcut character in case they also use it in the other shortcuts - return holdShortcut + holdShortcut.reduce(baseValue, { $0.replacingOccurrences(of: String($1), with: "") }) + let cleanedShortcut = holdShortcut + holdShortcut.reduce(baseValue, { $0.replacingOccurrences(of: String($1), with: "") }) + if cleanedShortcut.sorted() == holdShortcut.sorted() { + return "" + } + return cleanedShortcut } return baseValue }