From 68a00f5174534476b54b5beb03c1f91d0a7a5ae0 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Mon, 28 Nov 2016 19:21:03 -0500 Subject: [PATCH] Open file now replaces scratch buffer if path is null and buffer is unmodified --- xedit.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xedit.c b/xedit.c index 01f9d5e..f702f0d 100644 --- a/xedit.c +++ b/xedit.c @@ -462,8 +462,12 @@ static void open_file(void) { char* file = cmdread(PickFileCmd); if (file) { file[strlen(file)-1] = '\0'; - OpenCmd[1] = file; - free(cmdread(OpenCmd)); + if (!getbuf(EDIT)->path && !getbuf(EDIT)->modified) { + buf_load(getbuf(EDIT), file); + } else { + OpenCmd[1] = file; + free(cmdread(OpenCmd)); + } } free(file); } -- 2.52.0