diff options
author | pommicket <pommicket@gmail.com> | 2023-08-07 07:19:56 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-08-07 07:19:56 -0400 |
commit | b146279b48f6a4f4bea8946cb3f0f1f5cc5a9985 (patch) | |
tree | 70069f2f622f3b6190fa1effcfb9ce9e14d8f94b /ted.c | |
parent | bdbce6fe3c647616d22867bbc82e011c91231dd3 (diff) |
handle more complicated renames
Diffstat (limited to 'ted.c')
-rw-r--r-- | ted.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -575,6 +575,10 @@ static Status ted_open_buffer(Ted *ted, u16 *buffer_idx, u16 *tab) { TextBuffer *ted_get_buffer_with_file(Ted *ted, const char *path) { if (!path) return NULL; + if (!path_is_absolute(path)) { + assert(0); + return NULL; + } bool *buffers_used = ted->buffers_used; TextBuffer *buffers = ted->buffers; @@ -879,3 +883,18 @@ void ted_remove_edit_notify(Ted *ted, EditNotifyID id) { } } } + +void ted_close_buffer(Ted *ted, TextBuffer *buffer) { + if (!buffer) return; + + u16 tab_idx=0; + Node *node = ted_buffer_location_in_node_tree(ted, buffer, &tab_idx); + node_tab_close(ted, node, tab_idx); +} + +bool ted_close_buffer_with_file(Ted *ted, const char *path) { + TextBuffer *buffer = ted_get_buffer_with_file(ted, path); + if (!buffer) return false; + ted_close_buffer(ted, buffer); + return true; +} |