summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-08 17:42:17 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-10 17:05:39 +0200
commit6f4a3f46577e9e5dc8b352c17021ca90b1f15d33 (patch)
treef1c8d6f2f440eef304beb4c99c0f66a8bcbf5ec5
parent6387145adc6567b64e20757c462f11b53e5f4b3b (diff)
downloadxK-6f4a3f46577e9e5dc8b352c17021ca90b1f15d33.tar.gz
xK-6f4a3f46577e9e5dc8b352c17021ca90b1f15d33.tar.xz
xK-6f4a3f46577e9e5dc8b352c17021ca90b1f15d33.zip
xP: advance unread marker in an inactive tab
-rw-r--r--xP/public/xP.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/xP/public/xP.js b/xP/public/xP.js
index eb27b46..48b2aef 100644
--- a/xP/public/xP.js
+++ b/xP/public/xP.js
@@ -221,18 +221,21 @@ rpc.addEventListener('BufferLine', event => {
return
}
- let visible = e.bufferName == bufferCurrent || e.leakToActive
+ let visible = !document.hidden &&
+ (e.bufferName == bufferCurrent || e.leakToActive)
b.lines.push({...line})
- if (!visible || b.newMessages || b.newUnimportantMessages) {
+ if (!(visible || e.leakToActive) ||
+ b.newMessages || b.newUnimportantMessages) {
if (line.isUnimportant)
b.newUnimportantMessages++
else
b.newMessages++
}
+
if (e.leakToActive) {
let bc = buffers.get(bufferCurrent)
bc.lines.push({...line, leaked: true})
- if (bc.newMessages || bc.newUnimportantMessages) {
+ if (!visible || bc.newMessages || bc.newUnimportantMessages) {
if (line.isUnimportant)
bc.newUnimportantMessages++
else