Skip to content

Commit e863cb5

Browse files
Merge pull request #403 from shinich39/feature/tags
Improve usability of Autocomplete
2 parents 3d4644d + 772ff04 commit e863cb5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

web/js/common/autocomplete.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,11 @@ export class TextAreaAutoComplete {
536536
#update() {
537537
let before = this.helper.getBeforeCursor();
538538
if (before?.length) {
539-
const m = before.match(/([^\s|,|;|"]+)$/);
539+
const m = before.match(/([^,;"|{}()\n]+)$/);
540540
if (m) {
541-
before = m[0];
541+
before = m[0]
542+
.replace(/^\s+/, "")
543+
.replace(/\s/g, "_") || null;
542544
} else {
543545
before = null;
544546
}
@@ -619,6 +621,10 @@ export class TextAreaAutoComplete {
619621
value = TextAreaAutoComplete.replacer(value);
620622
}
621623
value = this.#escapeParentheses(value);
624+
625+
// Remove underscore
626+
value = value.replace(/_/g, " ");
627+
622628
const afterCursor = this.helper.getAfterCursor();
623629
const shouldAddSeparator = !afterCursor.trim().startsWith(this.separator.trim());
624630
this.helper.insertAtCursor(

0 commit comments

Comments
 (0)