tex: edit command for non-existent files - neatvi - [fork] simple vi-type editor with UTF-8 support
 (HTM) git clone git://src.adamsgaard.dk/neatvi
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit 24a8fe7457134dd4423c4700bf715077b5f26df4
 (DIR) parent 390adf97095970215ad4f23c3288ec3e2d374e11
 (HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
       Date:   Thu, 14 May 2015 15:52:25 +0430
       
       ex: edit command for non-existent files
       
       Diffstat:
         M ex.c                                |       6 +++---
       
       1 file changed, 3 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/ex.c b/ex.c
       t@@ -192,13 +192,13 @@ static void ec_edit(char *ec)
                int fd;
                ex_arg(ec, arg);
                fd = open(arg, O_RDONLY);
       +        lbuf_rm(xb, 0, lbuf_len(xb));
                if (fd >= 0) {
       -                lbuf_rm(xb, 0, lbuf_len(xb));
                        lbuf_rd(xb, fd, 0);
       -                lbuf_undofree(xb);
                        close(fd);
       -                xrow = MAX(0, lbuf_len(xb) - 1);
                }
       +        xrow = MAX(0, lbuf_len(xb) - 1);
       +        lbuf_undofree(xb);
                snprintf(xpath, PATHLEN, "%s", arg);
        }