xP: also scroll to bottom on window resize

This commit is contained in:
Přemysl Eric Janouch 2022-09-10 18:09:46 +02:00
parent 632ac992ab
commit 36529a46fd
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -438,20 +438,28 @@ let Content = {
} }
let Buffer = { let Buffer = {
oncreate: vnode => { controller: new AbortController(),
if (vnode.dom !== undefined && bufferAutoscroll)
vnode.dom.scrollTop = vnode.dom.scrollHeight onbeforeremove: vnode => {
Buffer.controller.abort()
}, },
onupdate: vnode => { onupdate: vnode => {
Buffer.oncreate(vnode) if (bufferAutoscroll)
vnode.dom.scrollTop = vnode.dom.scrollHeight
},
oncreate: vnode => {
Buffer.onupdate(vnode)
window.addEventListener('resize', event => Buffer.onupdate(vnode),
{signal: Buffer.controller.signal})
}, },
view: vnode => { view: vnode => {
let lines = [] let lines = []
let b = buffers.get(bufferCurrent) let b = buffers.get(bufferCurrent)
if (b === undefined) if (b === undefined)
return return m('.buffer')
let lastDateMark = undefined let lastDateMark = undefined
let markBefore = b.lines.length let markBefore = b.lines.length