From 38e468dc4fd939b078b67e85a55aa04c1dfe8b6c Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Wed, 17 Apr 2024 09:02:37 -0400 Subject: [PATCH] restore selection on non-replace select --- public/scripts/slash-commands.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index d2ac1b33a..5f78d24ff 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -2266,6 +2266,13 @@ export async function setSlashCommandAutoComplete(textarea, isFloating = false) textarea.selectionStart = parserResult.start - 2 + selectedItem.replacer.length; textarea.selectionEnd = textarea.selectionStart; show(); + } else { + const selectionStart = textarea.selectionStart; + const selectionEnd = textarea.selectionDirection; + await pointerup; + textarea.focus(); + textarea.selectionStart = selectionStart; + textarea.selectionDirection = selectionEnd; } }; const showAutoCompleteDebounced = show;