Prevent modal from closing after escaping autocomplete

This commit is contained in:
Gregory Schier committed 2017-08-18 09:29:27 -07:00
1 parent 2867cd2527
commit 012b1f757b
1 file changed
+8
@@ -129,6 +129,14 @@ CodeMirror.defineOption('environmentAutocomplete', null, (cm, options) => {
let keydownDebounce = null;
cm.on('keydown', (cm, e) => {
// Close dropdown on Escape if it's open
if (cm.isHintDropdownActive() && e.key === 'Escape') {
cm.closeHint();
e.preventDefault();
e.stopPropagation();
return;
}
// Only operate on one-letter keys. This will filter out
// any special keys (Backspace, Enter, etc)
if (e.metaKey || e.ctrlKey || e.altKey || e.key.length > 1) {