xP: add a temporary lock for autoscroll
This commit is contained in:
parent
e3149b9abf
commit
d55402234c
@ -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'),
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user