diff options
author | Ron Yorston | 2021-06-21 11:30:39 +0100 |
---|---|---|
committer | Denys Vlasenko | 2021-06-21 15:37:28 +0200 |
commit | 51358757c709f9c489aa6b13b34141edf84183fa (patch) | |
tree | a1649e684229819cd5bab9a0ed0f195adb737957 /shell/ash_test/ash-misc/func_bash1.right | |
parent | ac4786ba002620eb4c046c847e69d6a12ea0e322 (diff) | |
download | busybox-51358757c709f9c489aa6b13b34141edf84183fa.zip busybox-51358757c709f9c489aa6b13b34141edf84183fa.tar.gz |
vi: fix backward search with GNU regex
With FEATURE_VI_REGEX_SEARCH enabled backward searches don't work.
This is problematic on distros that enable regexes, such as Tiny
Core Linux and Fedora.
When calling GNU re_search() with a negative range parameter
(indicating a backward search) the start offset must be set to
the end of the area being searched.
The return value of re_search() is the offset of the matched pattern
from the start of the area being searched. For a successful search
(positive return value) char_search() can return the pointer to
the start of the area plus the offset.
FEATURE_VI_REGEX_SEARCH isn't enabled by default but when it is:
function old new delta
char_search 256 247 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-9) Total: -9 bytes
Signed-off-by: Andrey Dobrovolsky <andrey.dobrovolsky.odessa@gmail.com>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test/ash-misc/func_bash1.right')
0 files changed, 0 insertions, 0 deletions