Merge pull request #3481 from matrix-org/bwindels/cider-ac-shifttab
Fix: don't block Shift+Tab in CIDER autocomplete
This commit is contained in:
commit
8301943cfa
1 changed files with 19 additions and 9 deletions
|
@ -346,25 +346,35 @@ export default class BasicMessageEditor extends React.Component {
|
||||||
this._insertText("\n");
|
this._insertText("\n");
|
||||||
handled = true;
|
handled = true;
|
||||||
// autocomplete or enter to send below shouldn't have any modifier keys pressed.
|
// autocomplete or enter to send below shouldn't have any modifier keys pressed.
|
||||||
} else if (!(event.metaKey || event.altKey || event.shiftKey)) {
|
} else {
|
||||||
|
const metaOrAltPressed = event.metaKey || event.altKey;
|
||||||
|
const modifierPressed = metaOrAltPressed || event.shiftKey;
|
||||||
if (model.autoComplete && model.autoComplete.hasCompletions()) {
|
if (model.autoComplete && model.autoComplete.hasCompletions()) {
|
||||||
const autoComplete = model.autoComplete;
|
const autoComplete = model.autoComplete;
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "ArrowUp":
|
case "ArrowUp":
|
||||||
|
if (!modifierPressed) {
|
||||||
autoComplete.onUpArrow(event);
|
autoComplete.onUpArrow(event);
|
||||||
handled = true;
|
handled = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "ArrowDown":
|
case "ArrowDown":
|
||||||
|
if (!modifierPressed) {
|
||||||
autoComplete.onDownArrow(event);
|
autoComplete.onDownArrow(event);
|
||||||
handled = true;
|
handled = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "Tab":
|
case "Tab":
|
||||||
|
if (!metaOrAltPressed) {
|
||||||
autoComplete.onTab(event);
|
autoComplete.onTab(event);
|
||||||
handled = true;
|
handled = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "Escape":
|
case "Escape":
|
||||||
|
if (!modifierPressed) {
|
||||||
autoComplete.onEscape(event);
|
autoComplete.onEscape(event);
|
||||||
handled = true;
|
handled = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return; // don't preventDefault on anything else
|
return; // don't preventDefault on anything else
|
||||||
|
|
Loading…
Reference in a new issue