summaryrefslogtreecommitdiff
path: root/xC.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-28 16:25:16 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-28 21:20:59 +0200
commit5b57e9b41b3f339e05f1db285131f16c927d1d98 (patch)
tree2f66c0729fce8b7471c271c06c08814a6c3cf568 /xC.c
parent4d99690b89bda2814b78f01b88b7833296d47717 (diff)
downloadxK-5b57e9b41b3f339e05f1db285131f16c927d1d98.tar.gz
xK-5b57e9b41b3f339e05f1db285131f16c927d1d98.tar.xz
xK-5b57e9b41b3f339e05f1db285131f16c927d1d98.zip
xC/xP: fix unseen message counting
xC: advance unread message counters even with leaked messages, and don't unnecessarily set the highlighted flag. Plus clean up. xP: make leaked non-unimportant messages advance the counter for unimportant messages, so that the buffer doesn't get emboldened.
Diffstat (limited to 'xC.c')
-rw-r--r--xC.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/xC.c b/xC.c
index 1b90964..5aadb17 100644
--- a/xC.c
+++ b/xC.c
@@ -4612,34 +4612,30 @@ log_formatter (struct app_context *ctx, struct buffer *buffer,
&& buffer->type == BUFFER_SERVER)
|| (ctx->current_buffer->type != BUFFER_GLOBAL
&& buffer == ctx->current_buffer->server->buffer))
- can_leak = true;
+ can_leak = !ctx->isolate_buffers;
- relay_prepare_buffer_line (ctx, buffer, line,
- buffer != ctx->current_buffer && !ctx->isolate_buffers && can_leak);
+ bool leak_to_active = buffer != ctx->current_buffer && can_leak;
+ relay_prepare_buffer_line (ctx, buffer, line, leak_to_active);
relay_broadcast (ctx);
- bool displayed = true;
- if (ctx->terminal_suspended > 0)
- // Another process is using the terminal
- displayed = false;
- else if (buffer == ctx->current_buffer)
- buffer_line_display (ctx, buffer, line, false);
- else if (!ctx->isolate_buffers && can_leak)
- buffer_line_display (ctx, buffer, line, true);
- else
- displayed = false;
+ bool visible = (buffer == ctx->current_buffer || leak_to_active)
+ && ctx->terminal_suspended <= 0;
- // Advance the unread marker in active buffers but don't create a new one
- if (!displayed
- || (buffer == ctx->current_buffer && buffer->new_messages_count))
+ // Advance the unread marker but don't create a new one
+ if (!visible || buffer->new_messages_count)
{
buffer->new_messages_count++;
- if (flags & BUFFER_LINE_UNIMPORTANT)
+ if ((flags & BUFFER_LINE_UNIMPORTANT) || leak_to_active)
buffer->new_unimportant_count++;
- buffer->highlighted |= important;
}
- if (!displayed)
+
+ if (visible)
+ buffer_line_display (ctx, buffer, line, leak_to_active);
+ else
+ {
+ buffer->highlighted |= important;
refresh_prompt (ctx);
+ }
}
static void