summaryrefslogtreecommitdiff
path: root/xP
diff options
context:
space:
mode:
Diffstat (limited to 'xP')
-rw-r--r--xP/public/xP.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/xP/public/xP.js b/xP/public/xP.js
index 4c740ba..e18d03b 100644
--- a/xP/public/xP.js
+++ b/xP/public/xP.js
@@ -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 => {