AI edit: support CURSOR insert at caret position
This commit is contained in:
@@ -1055,6 +1055,11 @@ async function sendAiChat() {
|
||||
content.value = content.value.trimEnd() + '\n\n' + editContent
|
||||
} else if (hint === 'PREPEND') {
|
||||
content.value = editContent + '\n\n' + content.value
|
||||
} else if (hint === 'CURSOR' || hint === 'INSERT') {
|
||||
// Insert at cursor position
|
||||
const ta = editor.value
|
||||
const pos = ta ? ta.selectionStart : content.value.length
|
||||
content.value = content.value.substring(0, pos) + editContent + content.value.substring(pos)
|
||||
} else {
|
||||
// REPLACE or unknown — replace entire document
|
||||
content.value = hint === 'REPLACE' ? editContent : fullText
|
||||
|
||||
Reference in New Issue
Block a user