From 1b888cc723792ec0e49c7e5aaa78c3c5486a95b9 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Tue, 26 Mar 2024 10:59:06 +0100 Subject: Implement kill-buffer command Can be killed with the command `kill-buffer`, the shortcut `C-x k` or from the buffer menu. --- src/dged/buffers.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/dged/buffers.h') diff --git a/src/dged/buffers.h b/src/dged/buffers.h index f4c0a37..d521a78 100644 --- a/src/dged/buffers.h +++ b/src/dged/buffers.h @@ -1,5 +1,6 @@ #include "vec.h" +#include #include struct buffer; @@ -11,9 +12,12 @@ struct buffers_hook { void *userdata; }; +struct buffer_entry; + struct buffers { - VEC(struct buffer) buffers; + VEC(struct buffer_entry) buffers; VEC(struct buffers_hook) add_hooks; + VEC(struct buffers_hook) remove_hooks; }; void buffers_init(struct buffers *buffers, uint32_t initial_capacity); @@ -23,6 +27,8 @@ struct buffer *buffers_find(struct buffers *buffers, const char *name); struct buffer *buffers_find_by_filename(struct buffers *buffers, const char *path); +bool buffers_remove(struct buffers *buffers, const char *name); + uint32_t buffers_add_add_hook(struct buffers *buffers, buffers_hook_cb callback, void *userdata); uint32_t buffers_add_remove_hook(struct buffers *buffers, @@ -31,4 +37,7 @@ uint32_t buffers_add_remove_hook(struct buffers *buffers, void buffers_for_each(struct buffers *buffers, buffers_hook_cb callback, void *userdata); +uint32_t buffers_num_buffers(struct buffers *buffers); +struct buffer *buffers_first(struct buffers *buffers); + void buffers_destroy(struct buffers *buffers); -- cgit v1.2.3