summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-07-29 15:46:13 -0400
committerpommicket <pommicket@gmail.com>2022-07-29 15:46:13 -0400
commitefce2c731927adc4aaf26d6cc6c165bbced39eb5 (patch)
tree39c4eca8347f132c413a7405c2c3ae35d0fb0903 /buffer.c
parent296b4eca9479bdd1302c4b2d910f3ddd8c955fb9 (diff)
auto reload config
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index d73e68c..65a90ab 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2178,8 +2178,13 @@ bool buffer_save(TextBuffer *buffer) {
}
buffer->last_write_time = time_last_modified(buffer->filename);
bool success = !buffer_haserr(buffer);
- if (success)
+ if (success) {
buffer->undo_history_write_pos = arr_len(buffer->undo_history);
+ char const *name = buffer->filename ? path_filename(buffer->filename) : TED_UNTITLED;
+ if (streq(name, "ted.cfg") && buffer_settings(buffer)->auto_reload_config) {
+ ted_load_configs(buffer->ted);
+ }
+ }
return success;
} else {
buffer_seterr(buffer, "Couldn't open file %s for writing: %s.", buffer->filename, strerror(errno));