From e9dc79b5e43134bea9eb71f0827a881d86d0b560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 29 Nov 2016 12:06:01 +0100 Subject: vis: avoid inconsistent state after file reloading with :e When a file is opened in multiple windows we could end up in an inconsistent state by doing: $ vis some-file :spl :e At this point the two windows were referencing different file objects thus changes in one would not affect the other although they have the same path. Another option would be to reload all windows currently displaying the file being reloaded. We opt for the simpler fix for now. --- vis-cmds.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vis-cmds.c b/vis-cmds.c index 11a92dc..18169f5 100644 --- a/vis-cmds.c +++ b/vis-cmds.c @@ -321,8 +321,13 @@ static bool cmd_edit(Vis *vis, Win *win, Command *cmd, const char *argv[], Curso info_unsaved_changes(vis); return false; } - if (!argv[1]) + if (!argv[1]) { + if (oldwin->file->refcount > 1) { + vis_info_show(vis, "Can not reload file being opened multiple times"); + return false; + } return vis_window_reload(oldwin); + } if (!openfiles(vis, &argv[1])) return false; if (vis->win != oldwin) { -- cgit v1.2.3