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 = {
oncreate: vnode => {
if (vnode.dom !== undefined && bufferAutoscroll)
vnode.dom.scrollTop = vnode.dom.scrollHeight
controller: new AbortController(),
onbeforeremove: vnode => {
Buffer.controller.abort()
},
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 => {
let lines = []
let b = buffers.get(bufferCurrent)
if (b === undefined)
return
return m('.buffer')
let lastDateMark = undefined
let markBefore = b.lines.length