From 08aefc9dc5becd3b25a70045c1377a6706035a6e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 30 Jun 2021 21:56:45 +0200 Subject: [PATCH] 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. --- components/composer.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/composer.js b/components/composer.js index 4b5a4ad..cd62797 100644 --- a/components/composer.js +++ b/components/composer.js @@ -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;