]> git.mdlowis.com Git - projs/tide.git/commitdiff
Open file now replaces scratch buffer if path is null and buffer is unmodified
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 29 Nov 2016 00:21:03 +0000 (19:21 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 29 Nov 2016 00:21:03 +0000 (19:21 -0500)
xedit.c

diff --git a/xedit.c b/xedit.c
index 01f9d5ec3f3633fc4e631c39cd1473c7c7157b85..f702f0d345baaafc30a829ab7d055dfbb8887129 100644 (file)
--- 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);
 }