aboutsummaryrefslogtreecommitdiff
path: root/editors/vi.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-02-15 13:25:04 +0000
committerRon Yorston <rmy@pobox.com>2020-02-15 13:25:04 +0000
commit0abe89bc214c9d1f16f32c4339792066b875b7c6 (patch)
tree3748f654565bd08513093ebfbb68487f612b5e3f /editors/vi.c
parent6885083a7e4f94938ca0a98e2c6c69a84eb08a1f (diff)
parenta6e48dead331c3c19e070992d2d571e74a1d9a8d (diff)
downloadbusybox-w32-0abe89bc214c9d1f16f32c4339792066b875b7c6.tar.gz
busybox-w32-0abe89bc214c9d1f16f32c4339792066b875b7c6.tar.bz2
busybox-w32-0abe89bc214c9d1f16f32c4339792066b875b7c6.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'editors/vi.c')
-rw-r--r--editors/vi.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 948b95ae6..131c018a2 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2317,7 +2317,6 @@ static char *get_one_address(char *p, int *addr) // get colon addr, if present
2317 int st; 2317 int st;
2318 char *q; 2318 char *q;
2319 IF_FEATURE_VI_YANKMARK(char c;) 2319 IF_FEATURE_VI_YANKMARK(char c;)
2320 IF_FEATURE_VI_SEARCH(char *pat;)
2321 2320
2322 *addr = -1; // assume no addr 2321 *addr = -1; // assume no addr
2323 if (*p == '.') { // the current line 2322 if (*p == '.') { // the current line
@@ -2342,16 +2341,20 @@ static char *get_one_address(char *p, int *addr) // get colon addr, if present
2342#endif 2341#endif
2343#if ENABLE_FEATURE_VI_SEARCH 2342#if ENABLE_FEATURE_VI_SEARCH
2344 else if (*p == '/') { // a search pattern 2343 else if (*p == '/') { // a search pattern
2345 q = strchrnul(++p, '/'); 2344 q = strchrnul(p + 1, '/');
2346 pat = xstrndup(p, q - p); // save copy of pattern 2345 if (p + 1 != q) {
2346 // save copy of new pattern
2347 free(last_search_pattern);
2348 last_search_pattern = xstrndup(p, q - p);
2349 }
2347 p = q; 2350 p = q;
2348 if (*p == '/') 2351 if (*p == '/')
2349 p++; 2352 p++;
2350 q = char_search(dot, pat, (FORWARD << 1) | FULL); 2353 q = char_search(next_line(dot), last_search_pattern + 1,
2354 (FORWARD << 1) | FULL);
2351 if (q != NULL) { 2355 if (q != NULL) {
2352 *addr = count_lines(text, q); 2356 *addr = count_lines(text, q);
2353 } 2357 }
2354 free(pat);
2355 } 2358 }
2356#endif 2359#endif
2357 else if (*p == '$') { // the last line in file 2360 else if (*p == '$') { // the last line in file