summaryrefslogtreecommitdiff
path: root/xP/public/xP.js
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-06 23:17:47 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-07 13:04:30 +0200
commit976e7bfbb4d9f90f0d666e547b15720290ba4389 (patch)
tree966efac5ad1dda9d952aff0224e7bbb273bd487b /xP/public/xP.js
parent5fd76ba6f90f3d5c341f4ce7ca23560497e899a3 (diff)
downloadxK-976e7bfbb4d9f90f0d666e547b15720290ba4389.tar.gz
xK-976e7bfbb4d9f90f0d666e547b15720290ba4389.tar.xz
xK-976e7bfbb4d9f90f0d666e547b15720290ba4389.zip
xP: separate input buffers
Diffstat (limited to 'xP/public/xP.js')
-rw-r--r--xP/public/xP.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/xP/public/xP.js b/xP/public/xP.js
index dba8a99..19a769a 100644
--- a/xP/public/xP.js
+++ b/xP/public/xP.js
@@ -163,13 +163,22 @@ rpc.addEventListener('BufferRemove', event => {
})
rpc.addEventListener('BufferActivate', event => {
- let e = event.detail
+ let e = event.detail, b = buffers.get(e.bufferName)
+ let old = buffers.get(bufferCurrent)
bufferCurrent = e.bufferName
- setTimeout(() => {
- let el = document.getElementById('input')
- if (el !== null)
- el.focus()
- })
+
+ let textarea = document.getElementById('input')
+ if (textarea === null)
+ return
+
+ textarea.focus()
+ if (old !== undefined)
+ old.input = textarea.value
+
+ if (b !== undefined)
+ textarea.value = b.input || ''
+ else
+ textarea.value = ''
})
rpc.addEventListener('BufferLine', event => {
@@ -388,8 +397,6 @@ function onKeyDown(event) {
event.preventDefault()
}
-// TODO: This should be remembered across buffer switches,
-// and we'll probably have to intercept /all/ key presses.
let Input = {
view: vnode => {
return m('textarea#input', {