diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-21 11:50:51 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-21 11:50:51 -0500 |
commit | dd91d6c72625cc7ed2ec5954a5cbca35fd7655d4 (patch) | |
tree | 4b1e52098e3fdbb9a36395c33ad057b7cbaf0d01 /ted-base.c | |
parent | 3d86329abd754319a36459f8eb3e4bce6efffe1e (diff) |
split file selector into its own thing
Diffstat (limited to 'ted-base.c')
-rw-r--r-- | ted-base.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -86,17 +86,15 @@ static void ted_load_font(Ted *ted) { } } -// returns buffer of new file -static TextBuffer *ted_open_file(Ted *ted, char const *filename) { +// returns buffer of new file, or NULL on failure +static WarnUnusedResult TextBuffer *ted_open_file(Ted *ted, char const *filename) { TextBuffer *open_to = &ted->main_buffer; - buffer_load_file(open_to, filename); - if (buffer_haserr(open_to)) { - // @TODO: something - ted_seterr_to_buferr(ted, open_to); - return NULL; - } else { + if (buffer_load_file(open_to, filename)) { ted->active_buffer = open_to; return open_to; + } else { + ted_seterr_to_buferr(ted, open_to); + return NULL; } } |