diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-08-09 10:17:49 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-08-09 10:17:49 +0200 |
| commit | cef8f2a7448a16867771222ed5aeddfab7ab8f54 (patch) | |
| tree | 5fc4e965d8bffb7013523b2cbf957c730cf25197 /editor.c | |
| parent | 8cb0071c7a42c1b2a436a97a401f1fefb07768c6 (diff) | |
| download | vis-cef8f2a7448a16867771222ed5aeddfab7ab8f54.tar.gz vis-cef8f2a7448a16867771222ed5aeddfab7ab8f54.tar.xz | |
vis: fix :edit! command
It now correctly re-edits the file (i.e reloads it from disk).
Diffstat (limited to 'editor.c')
| -rw-r--r-- | editor.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -42,10 +42,13 @@ void editor_windows_arrange(Editor *ed, enum UiLayout layout) { } bool editor_window_reload(Win *win) { - /* can't reload unsaved file */ - if (!win->file->name) - return false; - File *file = file_new(win->editor, win->file->name); + const char *name = win->file->name; + if (!name) + return false; /* can't reload unsaved file */ + /* temporarily unset file name, otherwise file_new returns the same File */ + win->file->name = NULL; + File *file = file_new(win->editor, name); + win->file->name = name; if (!file) return false; file_free(win->editor, win->file); |
