From d89dae5c28fd77005d68f7408193f5d13d20ea13 Mon Sep 17 00:00:00 2001 From: shinich39 Date: Thu, 12 Dec 2024 06:33:23 +0900 Subject: [PATCH] fix cursor detection --- web/js/common/autocomplete.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/web/js/common/autocomplete.js b/web/js/common/autocomplete.js index 372a2e4..21bda1b 100644 --- a/web/js/common/autocomplete.js +++ b/web/js/common/autocomplete.js @@ -494,17 +494,18 @@ export class TextAreaAutoComplete { } #getFilteredWords(term) { - term = term.toLocaleLowerCase() + term = term.toLocaleLowerCase(); const priorityMatches = []; const prefixMatches = []; const includesMatches = []; for (const word of Object.keys(this.words)) { const lowerWord = word.toLocaleLowerCase(); - if (lowerWord === term) { - // Dont include exact matches - continue; - } + // Show exact matches + // if (lowerWord === term) { + // // Dont include exact matches + // continue; + // } const pos = lowerWord.indexOf(term); if (pos === -1) { @@ -621,6 +622,10 @@ export class TextAreaAutoComplete { value = TextAreaAutoComplete.replacer(value); } value = this.#escapeParentheses(value); + + // Remove underscore + value = value.replace("_", " "); + const afterCursor = this.helper.getAfterCursor(); const shouldAddSeparator = !afterCursor.trim().startsWith(this.separator.trim()); this.helper.insertAtCursor(