summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-21 03:35:35 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-21 03:35:35 +0200
commit1eb38fa5ec424d7f8898951eda751ef188540725 (patch)
treea3e7fd76bbc243e202155e7fef90e5410186f83a /degesch.c
parent3c982c7077bf32034d3931c256be586026c95c72 (diff)
downloadxK-1eb38fa5ec424d7f8898951eda751ef188540725.tar.gz
xK-1eb38fa5ec424d7f8898951eda751ef188540725.tar.xz
xK-1eb38fa5ec424d7f8898951eda751ef188540725.zip
degesch: implement /buffer clear
At least somehow.
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/degesch.c b/degesch.c
index e829fb0..ccd5d00 100644
--- a/degesch.c
+++ b/degesch.c
@@ -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"))
{