aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xC-proto1
-rw-r--r--xC.c5
-rw-r--r--xP/public/xP.js11
3 files changed, 13 insertions, 4 deletions
diff --git a/xC-proto b/xC-proto
index 7b77e5d..52bab54 100644
--- a/xC-proto
+++ b/xC-proto
@@ -63,6 +63,7 @@ struct EventMessage {
void;
case BUFFER_UPDATE:
string buffer_name;
+ bool hide_unimportant;
case BUFFER_STATS:
string buffer_name;
// These are cumulative, even for lines flushed out from buffers.
diff --git a/xC.c b/xC.c
index c440abc..1399744 100644
--- a/xC.c
+++ b/xC.c
@@ -3068,6 +3068,7 @@ relay_prepare_buffer_update (struct app_context *ctx, struct buffer *buffer)
struct relay_event_data_buffer_update *e = &m->data.buffer_update;
e->event = RELAY_EVENT_BUFFER_UPDATE;
e->buffer_name = str_from_cstr (buffer->name);
+ e->hide_unimportant = buffer->hide_unimportant;
}
static void
@@ -14202,6 +14203,10 @@ on_toggle_unimportant (int count, int key, void *user_data)
(void) key;
struct app_context *ctx = user_data;
ctx->current_buffer->hide_unimportant ^= true;
+
+ relay_prepare_buffer_update (ctx, ctx->current_buffer);
+ relay_broadcast (ctx);
+
buffer_print_backlog (ctx, ctx->current_buffer);
return true;
}
diff --git a/xP/public/xP.js b/xP/public/xP.js
index 864323a..2e7732e 100644
--- a/xP/public/xP.js
+++ b/xP/public/xP.js
@@ -171,6 +171,7 @@ rpc.addEventListener('BufferUpdate', event => {
buffers.set(e.bufferName, (b = {lines: []}))
resetBufferStats(b)
}
+ b.hideUnimportant = e.hideUnimportant
})
rpc.addEventListener('BufferStats', event => {
@@ -465,6 +466,11 @@ let Buffer = {
let markBefore = b.lines.length
- b.newMessages - b.newUnimportantMessages
b.lines.forEach((line, i) => {
+ if (i == markBefore)
+ lines.push(m('.unread'))
+ if (line.isUnimportant && b.hideUnimportant)
+ return
+
let date = new Date(line.when)
let dateMark = date.toLocaleDateString()
if (dateMark !== lastDateMark) {
@@ -472,14 +478,10 @@ let Buffer = {
lastDateMark = dateMark
}
- if (i == markBefore)
- lines.push(m('.unread'))
-
let attrs = {}
if (line.leaked)
attrs.class = 'leaked'
- // TODO: Make use of isUnimportant.
lines.push(m('.time', {...attrs}, date.toLocaleTimeString()))
lines.push(m(Content, {...attrs}, line))
})
@@ -604,6 +606,7 @@ let Main = {
return m('.xP', {}, [
m('.title', {}, [`xP (${state})`, m(Toolbar)]),
m('.middle', {}, [m(BufferList), m(BufferContainer)]),
+ // TODO: Indicate hideUnimportant.
m('.status', {}, bufferCurrent),
m(Input),
])