degesch: implement /buffer clear

At least somehow.
This commit is contained in:
Přemysl Eric Janouch 2015-06-21 03:35:35 +02:00
parent 3c982c7077
commit 1eb38fa5ec
1 changed files with 13 additions and 1 deletions

View File

@ -2683,6 +2683,16 @@ buffer_rename (struct app_context *ctx,
}
}
static void
buffer_clear (struct buffer *buffer)
{
LIST_FOR_EACH (struct buffer_line, iter, buffer->lines)
buffer_line_destroy (iter);
buffer->lines = buffer->lines_tail = NULL;
buffer->lines_count = 0;
}
static struct buffer *
buffer_at_index (struct app_context *ctx, int n)
{
@ -5930,7 +5940,9 @@ handle_command_buffer (struct app_context *ctx, struct handler_args *a)
show_buffers_list (ctx);
else if (!strcasecmp_ascii (action, "clear"))
{
// TODO
buffer_clear (a->buffer);
// XXX: clear screen?
buffer_print_backlog (ctx, a->buffer);
}
else if (!strcasecmp_ascii (action, "move"))
{