From c0a104e84297d5272e87da0aa9382696fdef45b9 Mon Sep 17 00:00:00 2001 From: NineKey Date: Sun, 13 Sep 2026 20:49:27 +0800 Subject: [PATCH] Keep trailing prompt text in place during weighting --- web/dynamic_loader.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/dynamic_loader.js b/web/dynamic_loader.js index dcf3833..dbc8e83 100644 --- a/web/dynamic_loader.js +++ b/web/dynamic_loader.js @@ -358,7 +358,13 @@ app.registerExtension({ while ((current = walker.nextNode())) { if (current.nodeType === Node.TEXT_NODE) { const length = current.nodeValue.length; - if (remaining <= length) { + // At an exact text-node boundary prefer the next + // DOM position. A range ending inside the prior + // node is visually equivalent, but Chromium can + // split a contenteditable line there while + // replacing it and move the following punctuation + // onto a new line. + if (remaining < length) { const range = document.createRange(); const chip = current.parentElement?.closest(".dynamic-tag-chip"); if (chip && remaining === 0) range.setStartBefore(chip);