aboutsummaryrefslogtreecommitdiff
path: root/xP/public
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-07 15:33:38 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-07 15:34:52 +0200
commit2341228efd02bcd4c99214885a5214826bfffa5c (patch)
treeedab812d3e72c6b6e689db704c4ffb4dfbdbae0d /xP/public
parent2e3005d88b6ee65689f5cf71905b014a56523160 (diff)
downloadxK-2341228efd02bcd4c99214885a5214826bfffa5c.tar.gz
xK-2341228efd02bcd4c99214885a5214826bfffa5c.tar.xz
xK-2341228efd02bcd4c99214885a5214826bfffa5c.zip
xP: implement buffer line leakage
Rather than on redisplay, these get cleared on reconnect.
Diffstat (limited to 'xP/public')
-rw-r--r--xP/public/xP.css3
-rw-r--r--xP/public/xP.js20
2 files changed, 16 insertions, 7 deletions
diff --git a/xP/public/xP.css b/xP/public/xP.css
index 77e89fc..05badb0 100644
--- a/xP/public/xP.css
+++ b/xP/public/xP.css
@@ -63,6 +63,9 @@ body {
overflow-y: auto;
}
+.leaked {
+ opacity: 50%;
+}
.date {
padding: .3rem;
grid-column: span 2;
diff --git a/xP/public/xP.js b/xP/public/xP.js
index 7bcfeb2..1322a9b 100644
--- a/xP/public/xP.js
+++ b/xP/public/xP.js
@@ -195,10 +195,12 @@ rpc.addEventListener('BufferActivate', event => {
})
rpc.addEventListener('BufferLine', event => {
- let e = event.detail, b = buffers.get(e.bufferName)
- if (b === undefined)
- return
- b.lines.push({when: e.when, rendition: e.rendition, items: e.items})
+ let e = event.detail, b = buffers.get(e.bufferName),
+ line = {when: e.when, rendition: e.rendition, items: e.items}
+ if (b !== undefined)
+ b.lines.push({...line})
+ if (e.leakToActive && (b = buffers.get(bufferCurrent)) !== undefined)
+ b.lines.push({leaked: true, ...line})
})
rpc.addEventListener('BufferClear', event => {
@@ -327,7 +329,7 @@ let Content = {
classes.add(c)
}
let fg = -1, bg = -1, inverse = false
- return m('.content', {}, [mark, line.items.flatMap(item => {
+ return m('.content', vnode.attrs, [mark, line.items.flatMap(item => {
switch (item.kind) {
case 'Text':
return Content.linkify(item.text, {
@@ -393,8 +395,12 @@ let Buffer = {
lastDateMark = dateMark
}
- lines.push(m('.time', {}, date.toLocaleTimeString()))
- lines.push(m(Content, {}, line))
+ let attrs = {}
+ if (line.leaked)
+ attrs.class = 'leaked'
+
+ lines.push(m('.time', {...attrs}, date.toLocaleTimeString()))
+ lines.push(m(Content, {...attrs}, line))
})
return m('.buffer', {}, lines)
},