Skip to content

Commit ebc57ba

Browse files
committed
Allow use of shift as a modifier for keybindings
See PR 2388: "Key mappings for Shift + [non-printable char key]"
1 parent 9068a55 commit ebc57ba

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

background_scripts/commands.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Commands =
6262
# We sort modifiers here to match the order used in keyboard_utils.coffee.
6363
# The return value is a sequence of keys: e.g. "<Space><c-A>b" -> ["<space>", "<c-A>", "b"].
6464
parseKeySequence: do ->
65-
modifier = "(?:[acm]-)" # E.g. "a-", "c-", "m-".
65+
modifier = "(?:[acms]-)" # E.g. "a-", "c-", "m-", "s-".
6666
namedKey = "(?:[a-z][a-z0-9]+)" # E.g. "left" or "f12" (always two characters or more).
6767
modifiedKey = "(?:#{modifier}+(?:.|#{namedKey}))" # E.g. "c-*" or "c-left".
6868
specialKeyRegexp = new RegExp "^<(#{namedKey}|#{modifiedKey})>(.*)", "i"

lib/keyboard_utils.coffee

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ KeyboardUtils =
5454
modifiers.push "a" if event.altKey
5555
modifiers.push "c" if event.ctrlKey
5656
modifiers.push "m" if event.metaKey
57+
modifiers.push "s" if event.shiftKey and keyChar.length > 1
5758

5859
keyChar = [modifiers..., keyChar].join "-"
5960
keyChar = "<#{keyChar}>" if 1 < keyChar.length

0 commit comments

Comments
 (0)