tex: edit command and unspecified alternate file - 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 04a3edea64e70aae164a0550acaf5bf18ccac472
(DIR) parent b56cd611f89d222d7184c4845e910ecc2a9fba59
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Sun, 31 May 2015 15:40:25 +0430
ex: edit command and unspecified alternate file
Diffstat:
M ex.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/ex.c b/ex.c
t@@ -172,11 +172,15 @@ static void ec_edit(char *ec)
char arg[EXLEN];
int fd;
ex_arg(ec, arg);
- if (!strcmp(arg, "%") || !arg[0]) {
+ if (!arg[0] || !strcmp(arg, "%") || !strcmp(xpath, arg)) {
strcpy(arg, xpath);
} else if (!strcmp(arg, "#")) {
char xpath_tmp[PATHLEN];
int xrow_tmp = xrow;
+ if (!xpath_alt[0]) {
+ ex_show("\"#\" is unset\n");
+ return;
+ }
strcpy(xpath_tmp, xpath_alt);
strcpy(xpath_alt, xpath);
strcpy(xpath, xpath_tmp);