diff --git a/web/js/common/autocomplete.js b/web/js/common/autocomplete.js index d4c461a..9716408 100644 --- a/web/js/common/autocomplete.js +++ b/web/js/common/autocomplete.js @@ -536,9 +536,11 @@ export class TextAreaAutoComplete { #update() { let before = this.helper.getBeforeCursor(); if (before?.length) { - const m = before.match(/([^\s|,|;|"]+)$/); + const m = before.match(/([^,;"|{}()\n]+)$/); if (m) { - before = m[0]; + before = m[0] + .replace(/^\s+/, "") + .replace(/\s/g, "_") || null; } else { before = null; } @@ -619,6 +621,10 @@ export class TextAreaAutoComplete { value = TextAreaAutoComplete.replacer(value); } value = this.#escapeParentheses(value); + + // Remove underscore + value = value.replace(/_/g, " "); + const afterCursor = this.helper.getAfterCursor(); const shouldAddSeparator = !afterCursor.trim().startsWith(this.separator.trim()); this.helper.insertAtCursor(