aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2020-02-29 10:53:29 +0100
committerMarc André Tanner <mat@brain-dump.org>2020-02-29 12:37:15 +0100
commitdc5c1166abc29b6634649eb9872908acdc18c52e (patch)
tree25b00698ce5e03d6e541c6e88500ce4143badd71
parentbdfea7e6c1d1a7ad5b3d479bb2c30c7e610f2ee6 (diff)
downloadvis-dc5c1166abc29b6634649eb9872908acdc18c52e.tar.gz
vis-dc5c1166abc29b6634649eb9872908acdc18c52e.tar.xz
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.
-rw-r--r--sam.c2
1 files changed, 1 insertions, 1 deletions
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);