aboutsummaryrefslogtreecommitdiff
path: root/xP
diff options
context:
space:
mode:
Diffstat (limited to 'xP')
-rw-r--r--xP/public/xP.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/xP/public/xP.js b/xP/public/xP.js
index b02d2af..4d2c439 100644
--- a/xP/public/xP.js
+++ b/xP/public/xP.js
@@ -132,12 +132,14 @@ let rpc = new RelayRpc(proxy)
let buffers = new Map()
let bufferCurrent = undefined
let bufferLog = undefined
+let bufferAutoscroll = true
let connecting = true
rpc.connect().then(result => {
buffers.clear()
bufferCurrent = undefined
bufferLog = undefined
+ bufferAutoscroll = true
rpc.send({command: 'Hello', version: 1})
connecting = false
@@ -176,6 +178,7 @@ rpc.addEventListener('BufferActivate', event => {
let old = buffers.get(bufferCurrent)
bufferCurrent = e.bufferName
bufferLog = undefined
+ bufferAutoscroll = true
let textarea = document.getElementById('input')
if (textarea === null)
@@ -327,7 +330,8 @@ let Content = {
let Buffer = {
oncreate: vnode => {
- if (vnode.dom === undefined || bufferLog !== undefined)
+ if (vnode.dom === undefined ||
+ bufferLog !== undefined || !bufferAutoscroll)
return
let el = vnode.dom.children[1]
@@ -368,6 +372,10 @@ let Buffer = {
}
let Toolbar = {
+ toggleAutoscroll: () => {
+ bufferAutoscroll = !bufferAutoscroll
+ },
+
toggleLog: () => {
if (bufferLog) {
bufferLog = undefined
@@ -385,6 +393,8 @@ let Toolbar = {
view: vnode => {
return m('.toolbar', {}, [
+ m('button', {onclick: Toolbar.toggleAutoscroll},
+ bufferAutoscroll ? 'Pause autoscroll' : 'Unpause autoscroll'),
m('button', {onclick: Toolbar.toggleLog},
bufferLog === undefined ? 'Show log' : 'Hide log'),
])