tex: all modifications of a :g should be undone with :u - neatvi - [fork] simpl… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit d550e4e2117866d1f2d99bc5279d545d1c10a30d | |
parent dd40b8405b61a172a6712593ef0ceaa75ae0c5d3 | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Sun, 27 Dec 2015 08:04:03 +0330 | |
ex: all modifications of a :g should be undone with :u | |
Diffstat: | |
M ex.c | 18 ++++++++++++++---- | |
1 file changed, 14 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/ex.c b/ex.c | |
t@@ -720,6 +720,8 @@ static int ec_cmap(char *ec) | |
return 0; | |
} | |
+static int ex_exec(char *ln); | |
+ | |
static int ec_glob(char *ec) | |
{ | |
char loc[EXLEN], cmd[EXLEN]; | |
t@@ -750,7 +752,7 @@ static int ec_glob(char *ec) | |
if ((rset_find(re, ln, LEN(offs) / 2, offs, 0) < 0) == not) { | |
int len = lbuf_len(xb); | |
xrow = i; | |
- ex_command(s); | |
+ ex_exec(s); | |
i += lbuf_len(xb) - len; | |
end += lbuf_len(xb) - len; | |
} | |
t@@ -863,24 +865,32 @@ static struct excmd { | |
}; | |
/* execute a single ex command */ | |
-void ex_command(char *ln) | |
+static int ex_exec(char *ln) | |
{ | |
char ec[EXLEN]; | |
char cmd[EXLEN]; | |
int i; | |
+ int ret = 0; | |
while (*ln) { | |
ln = ex_line(ln, ec); | |
ex_cmd(ec, cmd); | |
for (i = 0; i < LEN(excmds); i++) { | |
if (!strcmp(excmds[i].abbr, cmd) || | |
!strcmp(excmds[i].name, cmd)) { | |
- excmds[i].ec(ec); | |
+ ret = excmds[i].ec(ec); | |
break; | |
} | |
} | |
if (!xvis && !cmd[0]) | |
- ec_print(ec); | |
+ ret = ec_print(ec); | |
} | |
+ return ret; | |
+} | |
+ | |
+/* execute a single ex command */ | |
+void ex_command(char *ln) | |
+{ | |
+ ex_exec(ln); | |
lbuf_modified(xb); | |
} | |