vi backward regex search
Andrey Dobrovolsky
andrey.dobrovolsky.odessa at gmail.com
Sat Feb 15 23:38:28 UTC 2020
Hi, busy people!
If busybox is built with CONFIG_FEATURE_VI_REGEX_SEARCH=y vi is unable to
search backward. Proposed patch for 1.31.1 is:
--- vi.c.old 2019-06-10 13:50:53.000000000 +0300
+++ vi.c 2020-02-15 15:22:24.851557863 +0200
@@ -2189,15 +2189,11 @@
// re_search() >= 0: index of found pattern
// struct pattern char int int int struct reg
// re_search(*pattern_buffer, *string, size, start, range, *regs)
- i = re_search(&preg, q, size, /*start:*/ 0, range, /*struct
re_registers*:*/ NULL);
+ i = re_search(&preg, q, size, (range<0)?size:0 , range, /*struct
re_registers*:*/ NULL);
regfree(&preg);
if (i < 0)
return NULL;
- if (dir_and_range > 0) // FORWARD?
- p = p + i;
- else
- p = p - i;
- return p;
+ return (q + i) ;
}
# else
# if ENABLE_FEATURE_VI_SETOPTS
Regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20200216/1e86a483/attachment.html>
More information about the busybox
mailing list