vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit eb932259285bcb15a10993b3e6c47a0967d85168
parent acff723ecb08ba35630c3b70d1b6a0fc1a53c142
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 12 Sep 2014 14:19:11 +0200

Fix loading of not yet existing files

Diffstat:
Meditor.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/editor.c b/editor.c @@ -1,6 +1,7 @@ #define _BSD_SOURCE #include <stdlib.h> #include <string.h> +#include <unistd.h> #include "editor.h" #include "util.h" @@ -305,9 +306,11 @@ static EditorWin *editor_window_new_text(Editor *ed, Text *text) { } bool editor_window_new(Editor *ed, const char *filename) { - Text *text = text_load(filename); + Text *text = text_load(filename && access(filename, R_OK) == 0 ? filename : NULL); if (!text) return false; + if (filename) + text_filename_set(text, filename); EditorWin *win = editor_window_new_text(ed, text); if (!win) {