From dc5c1166abc29b6634649eb9872908acdc18c52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 29 Feb 2020 10:53:29 +0100 Subject: sam: fix spurious "file exists" warnings When initially opened with a non-existing file we would not correctly track the file's meta data resulting in spurious warnings upon subsequent writes. It is fixed by also saving the meta data for previously non-existing files with matching paths. --- sam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sam.c b/sam.c index 1903d3f..d0c6557 100644 --- a/sam.c +++ b/sam.c @@ -1702,7 +1702,7 @@ static bool cmd_write(Vis *vis, Win *win, Command *cmd, const char *argv[], Sele file_name_set(file, path); same_file = true; } - if (same_file) + if (same_file || (!existing_file && strcmp(file->name, path) == 0)) file->stat = text_stat(text); vis_event_emit(vis, VIS_EVENT_FILE_SAVE_POST, file, path); free(path); -- cgit v1.2.3