xP: remember buffer input selections

This commit is contained in:
Přemysl Eric Janouch 2022-09-11 01:01:16 +02:00
parent 95aa89ee97
commit add670212f
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 10 additions and 5 deletions

View File

@ -242,13 +242,18 @@ rpc.addEventListener('BufferActivate', event => {
return
textarea.focus()
if (old !== undefined)
if (old !== undefined) {
old.input = textarea.value
old.inputStart = textarea.selectionStart
old.inputEnd = textarea.selectionEnd
old.inputDirection = textarea.selectionDirection
}
if (b !== undefined)
textarea.value = b.input || ''
else
textarea.value = ''
textarea.value = ''
if (b !== undefined && b.input !== undefined) {
textarea.value = b.input
textarea.setSelectionRange(b.inputStart, b.inputEnd, b.inputDirection)
}
})
rpc.addEventListener('BufferLine', event => {