From 6bb3acc825849a4e550aaa009fcba68e434bcca0 Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Sun, 4 May 2025 23:34:26 +0900 Subject: [PATCH] fix: correct regex for identifying end of tag in insertTag function --- web/js/autocomplete.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/js/autocomplete.js b/web/js/autocomplete.js index e5de355..8397e54 100644 --- a/web/js/autocomplete.js +++ b/web/js/autocomplete.js @@ -655,7 +655,7 @@ function insertTag(inputElement, tagToInsert) { // Find the end of the word/tag at the cursor position, stopping at comma, newline, or end of string. // Match non-whitespace, non-comma, non-newline characters. - const currentWordEndMatch = text.substring(cursorPos).match(/^([^\s,\n]*)/); + const currentWordEndMatch = text.substring(cursorPos).match(/^([^\s]*[,\n]{1})/); // currentWordEnd is the position *after* the matched word part. // const currentWordEnd = currentWordEndMatch ? cursorPos + currentWordEndMatch[1].length : cursorPos; let currentWordEnd = cursorPos;