This commit is contained in:
James McCoy 2017-01-10 10:59:02 -05:00
parent 4c3204097c
commit fc47bd92df

View File

@ -3976,12 +3976,10 @@ current_search (
return OK; return OK;
} }
/* /// Check if the pattern is one character long or zero-width.
* Check if the pattern is one character long or zero-width. /// If move is true, check from the beginning of the buffer,
* If move is true, check from the beginning of the buffer, /// else from the current cursor position.
* else from the current cursor position. /// Returns TRUE, FALSE or -1 for failure.
* Returns TRUE, FALSE or -1 for failure.
*/
static int is_one_char(char_u *pattern, bool move) static int is_one_char(char_u *pattern, bool move)
{ {
regmmatch_T regmatch; regmmatch_T regmatch;
@ -4001,7 +3999,7 @@ static int is_one_char(char_u *pattern, bool move)
// init startcol correctly // init startcol correctly
regmatch.startpos[0].col = -1; regmatch.startpos[0].col = -1;
/* move to match */ // move to match
if (move) { if (move) {
clearpos(&pos); clearpos(&pos);
} else { } else {
@ -4010,10 +4008,10 @@ static int is_one_char(char_u *pattern, bool move)
flag = SEARCH_START; flag = SEARCH_START;
} }
if (searchit(curwin, curbuf, &pos, FORWARD, pattern, 1, if (searchit(curwin, curbuf, &pos, FORWARD, pattern, 1,
SEARCH_KEEP + flag, RE_SEARCH, 0, NULL) != FAIL) { SEARCH_KEEP + flag, RE_SEARCH, 0, NULL) != FAIL) {
/* Zero-width pattern should match somewhere, then we can check if // Zero-width pattern should match somewhere, then we can check if
* start and end are in the same position. */ // start and end are in the same position.
called_emsg = FALSE; called_emsg = false;
do { do {
regmatch.startpos[0].col++; regmatch.startpos[0].col++;
nmatched = vim_regexec_multi(&regmatch, curwin, curbuf, nmatched = vim_regexec_multi(&regmatch, curwin, curbuf,