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":
|
||||||
autoComplete.onUpArrow(event);
|
if (!modifierPressed) {
|
||||||
handled = true;
|
autoComplete.onUpArrow(event);
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "ArrowDown":
|
case "ArrowDown":
|
||||||
autoComplete.onDownArrow(event);
|
if (!modifierPressed) {
|
||||||
handled = true;
|
autoComplete.onDownArrow(event);
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "Tab":
|
case "Tab":
|
||||||
autoComplete.onTab(event);
|
if (!metaOrAltPressed) {
|
||||||
handled = true;
|
autoComplete.onTab(event);
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "Escape":
|
case "Escape":
|
||||||
autoComplete.onEscape(event);
|
if (!modifierPressed) {
|
||||||
handled = true;
|
autoComplete.onEscape(event);
|
||||||
|
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