summaryrefslogtreecommitdiff
path: root/xP/public/xP.js
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-10 18:09:46 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-10 18:10:08 +0200
commit36529a46fd52d8924923027c79afe44cd810861e (patch)
tree2b7f4008e44e88196e387d485fe3a88f7dd7fbe1 /xP/public/xP.js
parent632ac992ab4a032a3415b99a419c0c88c22157e5 (diff)
downloadxK-36529a46fd52d8924923027c79afe44cd810861e.tar.gz
xK-36529a46fd52d8924923027c79afe44cd810861e.tar.xz
xK-36529a46fd52d8924923027c79afe44cd810861e.zip
xP: also scroll to bottom on window resize
Diffstat (limited to 'xP/public/xP.js')
-rw-r--r--xP/public/xP.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/xP/public/xP.js b/xP/public/xP.js
index 7f64473..864323a 100644
--- a/xP/public/xP.js
+++ b/xP/public/xP.js
@@ -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