KeyShortcutHandler allow capital letters. close #68
This commit is contained in:
@@ -36,5 +36,7 @@
|
|||||||
(case (id.toString)
|
(case (id.toString)
|
||||||
((when (KEY_MAP.exists key) key)
|
((when (KEY_MAP.exists key) key)
|
||||||
(dictGet KEY_MAP key))
|
(dictGet KEY_MAP key))
|
||||||
|
((when FlxG.keys.pressed.SHIFT key)
|
||||||
|
(.toUpperCase key))
|
||||||
(key (.toLowerCase key))
|
(key (.toLowerCase key))
|
||||||
(otherwise (throw "FlxKey.toString returned null!")))))))
|
(otherwise (throw "FlxKey.toString returned null!")))))))
|
@@ -51,7 +51,7 @@
|
|||||||
((Some _)
|
((Some _)
|
||||||
(case (stream.takeUntilAndDrop "]")
|
(case (stream.takeUntilAndDrop "]")
|
||||||
((Some newShortcuts)
|
((Some newShortcuts)
|
||||||
(extractKeyboardShortcuts str stream (+ shortcuts (newShortcuts.toLowerCase))))
|
(extractKeyboardShortcuts str stream (+ shortcuts newShortcuts)))
|
||||||
(otherwise
|
(otherwise
|
||||||
(tryCallOrThrow onBadShortcut "unclosed [ in $str" str null)
|
(tryCallOrThrow onBadShortcut "unclosed [ in $str" str null)
|
||||||
"")))
|
"")))
|
||||||
|
@@ -106,15 +106,17 @@
|
|||||||
vscode.ViewColumn.Two
|
vscode.ViewColumn.Two
|
||||||
(object
|
(object
|
||||||
enableScripts true)))
|
enableScripts true)))
|
||||||
(set keyListener (shortcutPanel.webview.onDidReceiveMessage ->:Void key (shortcutHandler.handleKey (the String key))))
|
(set keyListener
|
||||||
|
(shortcutPanel.webview.onDidReceiveMessage
|
||||||
|
->:Void key (shortcutHandler.handleKey (the String key))))
|
||||||
(set shortcutPanel.webview.html (shortcutPanelHtml prefixMap))
|
(set shortcutPanel.webview.html (shortcutPanelHtml prefixMap))
|
||||||
(shortcutPanel.webview.postMessage (object command "focus")))
|
(shortcutPanel.webview.postMessage (object command "focus")))
|
||||||
|
|
||||||
(function shortcutPanelHtml [:PrefixMap<String> prefixMap]
|
(function shortcutPanelHtml [:PrefixMap<String> prefixMap]
|
||||||
(let [&mut unusedKeys "abcdefghijklmnopqrstuvwxyz1234567890-/"
|
(let [&mut unusedKeys "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-/"
|
||||||
shortcutParagraphs
|
shortcutParagraphs
|
||||||
(for =>key shortcutKey prefixMap
|
(for =>key shortcutKey prefixMap
|
||||||
(set unusedKeys (unusedKeys.replace (key.toLowerCase) ""))
|
(set unusedKeys (unusedKeys.replace key ""))
|
||||||
"<p><strong>${key}</strong> - $(case shortcutKey
|
"<p><strong>${key}</strong> - $(case shortcutKey
|
||||||
((Prefix innerMap)
|
((Prefix innerMap)
|
||||||
"$(Lambda.count innerMap) shortcuts")
|
"$(Lambda.count innerMap) shortcuts")
|
||||||
@@ -143,7 +145,12 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.addEventListener('keydown', function (e) {
|
window.addEventListener('keydown', function (e) {
|
||||||
vscode.postMessage(e.key);
|
var key = e.key;
|
||||||
|
if (key == 'Shift')
|
||||||
|
return;
|
||||||
|
if (key.length == 1 && e.shiftKey)
|
||||||
|
key = key.toUpperCase();
|
||||||
|
vscode.postMessage(key);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
Reference in New Issue
Block a user