diff options
author | pommicket <pommicket@gmail.com> | 2023-08-05 10:33:26 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-08-05 10:33:26 -0400 |
commit | 2cd73992ef519eb1aaf6c83abe87a34dadf7ac31 (patch) | |
tree | 89aa98c9641dd8de2975df6a78a819de1ff38935 /buffer.c | |
parent | b3244ce71e137b4a259d78b7dc043beb2a5c2aa9 (diff) |
add some functions for plug-ins
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -66,6 +66,26 @@ bool buffer_is_named_file(TextBuffer *buffer) { return buffer->path != NULL; } + +bool buffer_is_view_only(TextBuffer *buffer) { + return buffer->view_only; +} + +void buffer_set_view_only(TextBuffer *buffer, bool view_only) { + buffer->view_only = view_only; +} + +size_t buffer_get_path(TextBuffer *buffer, char *buf, size_t bufsz) { + if (!buffer->path) { + if (bufsz) *buf = '\0'; + return 1; + } + if (bufsz > 0) { + str_cpy(buf, bufsz, buffer->path); + } + return strlen(buffer->path) + 1; +} + const char *buffer_display_filename(TextBuffer *buffer) { return buffer->path ? path_filename(buffer->path) : BUFFER_UNTITLED; } |