diff options
| -rw-r--r-- | editor.c | 11 | ||||
| -rw-r--r-- | vis.c | 5 |
2 files changed, 10 insertions, 6 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); @@ -1812,8 +1812,9 @@ static bool cmd_edit(Filerange *range, enum CmdOpt opt, const char *argv[]) { return editor_window_reload(oldwin); if (!openfiles(&argv[1])) return false; - editor_window_close(oldwin); - return true; + if (vis->win != oldwin) + editor_window_close(oldwin); + return vis->win != oldwin; } static bool cmd_quit(Filerange *range, enum CmdOpt opt, const char *argv[]) { |
