diff options
| author | Albert Cervin <albert@acervin.com> | 2024-03-26 10:59:06 +0100 |
|---|---|---|
| committer | Albert Cervin <albert@acervin.com> | 2024-03-26 10:59:06 +0100 |
| commit | 1b888cc723792ec0e49c7e5aaa78c3c5486a95b9 (patch) | |
| tree | da0b4f6fcdf394b155938472a0ca0d100effb2ef /src/dged/buffers.h | |
| parent | 5b3234f34fd081a3fe81c95bd55f4bfc853568a5 (diff) | |
| download | dged-1b888cc723792ec0e49c7e5aaa78c3c5486a95b9.tar.gz dged-1b888cc723792ec0e49c7e5aaa78c3c5486a95b9.tar.xz dged-1b888cc723792ec0e49c7e5aaa78c3c5486a95b9.zip | |
Implement kill-buffer command
Can be killed with the command `kill-buffer`, the shortcut `C-x k`
or from the buffer menu.
Diffstat (limited to 'src/dged/buffers.h')
| -rw-r--r-- | src/dged/buffers.h | 11 |
1 files changed, 10 insertions, 1 deletions
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 <stdbool.h> #include <stdint.h> 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); |
