vi: searches in colon commands should wrap
The '/' and '?' search commands wrap to the other end of the buffer if the search target isn't found. When searches are used to specify addresses in colon commands they should do the same. (In traditional vi and vim this behaviour is controlled by the 'wrapscan' option. BusyBox vi doesn't have this option and always uses the default behaviour.) function old new delta colon 4033 4077 +44 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 44/0) Total: 44 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
4357569fdc
commit
08ad934ac4
@ -2527,8 +2527,13 @@ static char *get_one_address(char *p, int *result) // get colon addr, if present
|
|||||||
dir = ((unsigned)BACK << 1) | FULL;
|
dir = ((unsigned)BACK << 1) | FULL;
|
||||||
}
|
}
|
||||||
q = char_search(q, last_search_pattern + 1, dir);
|
q = char_search(q, last_search_pattern + 1, dir);
|
||||||
|
if (q == NULL) {
|
||||||
|
// no match, continue from other end of file
|
||||||
|
q = char_search(dir > 0 ? text : end - 1,
|
||||||
|
last_search_pattern + 1, dir);
|
||||||
if (q == NULL)
|
if (q == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
new_addr = count_lines(text, q);
|
new_addr = count_lines(text, q);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
Loading…
Reference in New Issue
Block a user