Introduction
Introduction Statistics Contact Development Disclaimer Help
tex: move cursor to the first change after undoing :s - neatvi - [fork] simple …
git clone git://src.adamsgaard.dk/neatvi
Log
Files
Refs
README
---
commit 54a452c55c89f3f3bc1a58741b81f2471c7a9c18
parent 84fad00b295c1fb13ea3baa0c8267b7aa4b035de
Author: Kyryl Melekhin <[email protected]>
Date: Wed, 3 Mar 2021 11:18:33 +0330
ex: move cursor to the first change after undoing :s
Diffstat:
M ex.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/ex.c b/ex.c
t@@ -743,8 +743,10 @@ static int ec_substitute(char *ec)
}
for (i = beg; i < end; i++) {
char *ln = lbuf_get(xb, i);
- struct sbuf *r = sbuf_make();
+ struct sbuf *r = NULL;
while (rset_find(re, ln, LEN(offs) / 2, offs, 0) >= 0) {
+ if (!r)
+ r = sbuf_make();
sbuf_mem(r, ln, offs[0]);
replace(r, rep, ln, offs);
ln += offs[1];
t@@ -753,9 +755,11 @@ static int ec_substitute(char *ec)
if (offs[1] <= 0) /* zero-length match */
sbuf_chr(r, (unsigned char) *ln++);
}
- sbuf_str(r, ln);
- lbuf_edit(xb, sbuf_buf(r), i, i + 1);
- sbuf_free(r);
+ if (r) {
+ sbuf_str(r, ln);
+ lbuf_edit(xb, sbuf_buf(r), i, i + 1);
+ sbuf_free(r);
+ }
}
rset_free(re);
free(rep);
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.