summaryrefslogtreecommitdiff
path: root/xC.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-16 02:46:03 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-16 02:52:16 +0200
commitd5153fe354dce4bc9aef990614dad29d9804aa9b (patch)
tree9cf649555d43861a8f17290efc08825d304c8549 /xC.c
parentee76186bef6f40da41f8cfa89a9c54ae9c9540f4 (diff)
downloadxK-d5153fe354dce4bc9aef990614dad29d9804aa9b.tar.gz
xK-d5153fe354dce4bc9aef990614dad29d9804aa9b.tar.xz
xK-d5153fe354dce4bc9aef990614dad29d9804aa9b.zip
xC/xP: implement M-H in the web frontend
Diffstat (limited to 'xC.c')
-rw-r--r--xC.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/xC.c b/xC.c
index 7f06083..ff7b3c4 100644
--- a/xC.c
+++ b/xC.c
@@ -5235,6 +5235,18 @@ buffer_clear (struct app_context *ctx, struct buffer *buffer)
buffer->lines_count = 0;
}
+static void
+buffer_toggle_unimportant (struct app_context *ctx, struct buffer *buffer)
+{
+ buffer->hide_unimportant ^= true;
+
+ relay_prepare_buffer_update (ctx, buffer);
+ relay_broadcast (ctx);
+
+ if (buffer == ctx->current_buffer)
+ buffer_print_backlog (ctx, buffer);
+}
+
static struct buffer *
buffer_at_index (struct app_context *ctx, int n)
{
@@ -14372,12 +14384,7 @@ on_toggle_unimportant (int count, int key, void *user_data)
(void) count;
(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);
+ buffer_toggle_unimportant (ctx, ctx->current_buffer);
return true;
}
@@ -15444,10 +15451,12 @@ client_message_buffer_name (const struct relay_command_message *m)
{
case RELAY_COMMAND_BUFFER_COMPLETE:
return m->data.buffer_input.buffer_name.str;
- case RELAY_COMMAND_BUFFER_INPUT:
- return m->data.buffer_input.buffer_name.str;
case RELAY_COMMAND_BUFFER_ACTIVATE:
return m->data.buffer_activate.buffer_name.str;
+ case RELAY_COMMAND_BUFFER_INPUT:
+ return m->data.buffer_input.buffer_name.str;
+ case RELAY_COMMAND_BUFFER_TOGGLE_UNIMPORTANT:
+ return m->data.buffer_toggle_unimportant.buffer_name.str;
case RELAY_COMMAND_BUFFER_LOG:
return m->data.buffer_log.buffer_name.str;
default:
@@ -15573,11 +15582,14 @@ client_process_message (struct client *c,
client_process_buffer_complete (c, m->command_seq, buffer,
&m->data.buffer_complete);
break;
+ case RELAY_COMMAND_BUFFER_ACTIVATE:
+ buffer_activate (c->ctx, buffer);
+ break;
case RELAY_COMMAND_BUFFER_INPUT:
process_input (c->ctx, buffer, m->data.buffer_input.text.str);
break;
- case RELAY_COMMAND_BUFFER_ACTIVATE:
- buffer_activate (c->ctx, buffer);
+ case RELAY_COMMAND_BUFFER_TOGGLE_UNIMPORTANT:
+ buffer_toggle_unimportant (c->ctx, buffer);
break;
case RELAY_COMMAND_BUFFER_LOG:
client_process_buffer_log (c, m->command_seq, buffer);