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 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 = ''
textarea.value = b.input || '' if (b !== undefined && b.input !== undefined) {
else textarea.value = b.input
textarea.value = '' textarea.setSelectionRange(b.inputStart, b.inputEnd, b.inputDirection)
}
}) })
rpc.addEventListener('BufferLine', event => { rpc.addEventListener('BufferLine', event => {