From: Michael D. Lowis Date: Tue, 29 Nov 2016 00:21:03 +0000 (-0500) Subject: Open file now replaces scratch buffer if path is null and buffer is unmodified X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=68a00f5174534476b54b5beb03c1f91d0a7a5ae0;p=projs%2Ftide.git Open file now replaces scratch buffer if path is null and buffer is unmodified --- 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); }