composer: add smart suffix after auto-completion

Append a space after a command name, so that arguments can be typed
directly. Append a colon after a nickname.
This commit is contained in:
Simon Ser 2021-06-30 21:56:45 +02:00
parent 856dd021e2
commit 08aefc9dc5

View file

@ -69,6 +69,14 @@ export default class Composer extends Component {
return;
}
if (wordStart === 0 && wordEnd === text.length) {
if (word.startsWith("/")) {
repl += " ";
} else {
repl += ": ";
}
}
text = text.slice(0, wordStart) + repl + text.slice(wordEnd);
input.value = text;