| tex: read the address in :r !cmd - neatvi - [fork] simple vi-type editor with U… | |
| git clone git://src.adamsgaard.dk/neatvi | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 24eedb0f1d1619ee2bdb5b47475a8dda4d241396 | |
| parent 8f0e940847db6c262e9159d00b2301aef0a1bc58 | |
| Author: Ali Gholami Rudi <[email protected]> | |
| Date: Mon, 4 Oct 2021 17:13:49 +0330 | |
| ex: read the address in :r !cmd | |
| Diffstat: | |
| M ex.c | 5 ++--- | |
| 1 file changed, 2 insertions(+), 3 deletions(-) | |
| --- | |
| diff --git a/ex.c b/ex.c | |
| t@@ -361,15 +361,15 @@ static int ec_edit(char *loc, char *cmd, char *arg) | |
| static int ec_read(char *loc, char *cmd, char *arg) | |
| { | |
| char msg[128]; | |
| - int beg, end; | |
| + int beg, end, pos; | |
| char *path; | |
| char *obuf; | |
| int n = lbuf_len(xb); | |
| path = arg[0] ? arg : ex_path(); | |
| if (ex_region(loc, &beg, &end)) | |
| return 1; | |
| + pos = lbuf_len(xb) ? end : 0; | |
| if (arg[0] == '!') { | |
| - int pos = MIN(xrow + 1, lbuf_len(xb)); | |
| char *ecmd = ex_pathexpand(arg, 1); | |
| if (!ecmd) | |
| return 1; | |
| t@@ -380,7 +380,6 @@ static int ec_read(char *loc, char *cmd, char *arg) | |
| free(obuf); | |
| } else { | |
| int fd = open(path, O_RDONLY); | |
| - int pos = lbuf_len(xb) ? end : 0; | |
| if (fd < 0) { | |
| ex_show("read failed\n"); | |
| return 1; |