vi: improve handling of anchored searches
Suppose we search for a git conflict marker '<<<<<<< HEAD' using the command '/^<<<'. Using 'n' to go to the next match finds '<<<' on the current line, apparently ignoring the '^' anchor. Set a flag in the compiled regular expression to indicate that the start of the string should not be considered a beginning-of-line anchor. An exception has to be made when the search starts from the beginning of the file. Make a similar change for end-of-line anchors. This doesn't affect a default build with VI_REGEX_SEARCH disabled. When it's enabled: function old new delta char_search 247 285 +38 Signed-off-by: NRon Yorston <rmy@pobox.com> Signed-off-by: NDenys Vlasenko <vda.linux@googlemail.com>
Showing
想要评论请 注册 或 登录