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

View File

@ -242,13 +242,18 @@ rpc.addEventListener('BufferActivate', event => {
return return
textarea.focus() textarea.focus()
if (old !== undefined) if (old !== undefined) {
old.input = textarea.value 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 => { rpc.addEventListener('BufferLine', event => {