This commit is contained in:
Timothy Jaeryang Baek 2025-04-04 09:17:19 -06:00
parent feaf434d4e
commit b612af29e9

View File

@ -152,7 +152,24 @@
chatInputElement.focus();
chatInputElement.dispatchEvent(new Event('input'));
chatInputElement.scrollTop = chatInputElement.scrollHeight;
const words = extractCurlyBraceWords(prompt);
if (words.length > 0) {
const word = words.at(0);
const fullPrompt = prompt;
prompt = prompt.substring(0, word?.endIndex + 1);
await tick();
chatInputElement.scrollTop = chatInputElement.scrollHeight;
prompt = fullPrompt;
await tick();
chatInputElement.setSelectionRange(word?.startIndex, word.endIndex + 1);
} else {
chatInputElement.scrollTop = chatInputElement.scrollHeight;
}
}
};
</script>