My use case involves setting keyCodeStringForKeyEquivalents of MASShortcuts directly into NSButtons' keyEquivalent properties.
MASShortcut class can help simplify display logic for special function keys such as "←". However, I found that keyCodeStringForKeyEquivalents of functions keys such as arrow, backspace, return and alike returns empty.
This PR:
Removes keyCodeString.length <= 1 testing in -[MASShortcut keyCodeStringForKeyEquivalent] since only keyCodeStrings of F keys contains multiple charactes.
Makes keyCodeStringForKeyEquivalent aligned up with keyCodeString. All keys are tested and should work, except for space and tab.
Using space for keyEquivalent is not supported by AppKit, see here.
Currently, tabs cannot be recorded by MASShortcutView.
Adds kMASShortcutFuctionKey definitions for missing NS*FunctionKeys outside of Unicode private range. Although definitions some keys (like NSBackspaceCharacter) can be found elsewhere in AppKit headers, this helps to make code consistent.
Replaces hared-coded values (119 and 115) into (kVK_Home and kVK_End) and adds comment for kVK_Help, which actually represents for 'Insert' on most keyboards.
My use case involves setting
keyCodeStringForKeyEquivalent
s ofMASShortcut
s directly intoNSButton
s'keyEquivalent
properties.MASShortcut
class can help simplify display logic for special function keys such as "←". However, I found thatkeyCodeStringForKeyEquivalent
s of functions keys such as arrow, backspace, return and alike returns empty.This PR:
keyCodeString.length <= 1
testing in-[MASShortcut keyCodeStringForKeyEquivalent]
since onlykeyCodeString
s of F keys contains multiple charactes.keyCodeStringForKeyEquivalent
aligned up withkeyCodeString
. All keys are tested and should work, except for space and tab.MASShortcutView
.kMASShortcutFuctionKey
definitions for missingNS*FunctionKey
s outside of Unicode private range. Although definitions some keys (likeNSBackspaceCharacter
) can be found elsewhere in AppKit headers, this helps to make code consistent.kVK_Home
andkVK_End
) and adds comment forkVK_Help
, which actually represents for 'Insert' on most keyboards.