mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
search: start_in_quotes in findmatchlimit is TriState
This commit is contained in:
parent
0e55d88639
commit
ba6417091c
@ -1563,7 +1563,6 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|
||||
int hash_dir = 0; /* Direction searched for # things */
|
||||
int comment_dir = 0; /* Direction searched for comments */
|
||||
pos_T match_pos; /* Where last slash-star was found */
|
||||
int start_in_quotes; /* start position is in quotes */
|
||||
int traveled = 0; /* how far we've searched so far */
|
||||
int ignore_cend = FALSE; /* ignore comment end */
|
||||
int cpo_match; /* vi compatible matching */
|
||||
@ -1754,7 +1753,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|
||||
backwards = !backwards;
|
||||
|
||||
do_quotes = -1;
|
||||
start_in_quotes = MAYBE;
|
||||
TriState start_in_quotes = kNone;
|
||||
clearpos(&match_pos);
|
||||
|
||||
/* backward search: Check if this line contains a single-line comment */
|
||||
@ -1928,23 +1927,26 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|
||||
inquote = FALSE;
|
||||
if (ptr[-1] == '\\') {
|
||||
do_quotes = 1;
|
||||
if (start_in_quotes == MAYBE) {
|
||||
/* Do we need to use at_start here? */
|
||||
if (start_in_quotes == kNone) {
|
||||
// Do we need to use at_start here?
|
||||
inquote = TRUE;
|
||||
start_in_quotes = TRUE;
|
||||
} else if (backwards)
|
||||
start_in_quotes = kTrue;
|
||||
} else if (backwards) {
|
||||
inquote = TRUE;
|
||||
}
|
||||
}
|
||||
if (pos.lnum > 1) {
|
||||
ptr = ml_get(pos.lnum - 1);
|
||||
if (*ptr && *(ptr + STRLEN(ptr) - 1) == '\\') {
|
||||
do_quotes = 1;
|
||||
if (start_in_quotes == MAYBE) {
|
||||
if (start_in_quotes == kNone) {
|
||||
inquote = at_start;
|
||||
if (inquote)
|
||||
start_in_quotes = TRUE;
|
||||
} else if (!backwards)
|
||||
if (inquote) {
|
||||
start_in_quotes = kTrue;
|
||||
}
|
||||
} else if (!backwards) {
|
||||
inquote = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* ml_get() only keeps one line, need to get linep again */
|
||||
@ -1952,8 +1954,9 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (start_in_quotes == MAYBE)
|
||||
start_in_quotes = FALSE;
|
||||
if (start_in_quotes == kNone) {
|
||||
start_in_quotes = kFalse;
|
||||
}
|
||||
|
||||
/*
|
||||
* If 'smartmatch' is set:
|
||||
@ -1972,7 +1975,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|
||||
/* at end of line without trailing backslash, reset inquote */
|
||||
if (pos.col == 0 || linep[pos.col - 1] != '\\') {
|
||||
inquote = FALSE;
|
||||
start_in_quotes = FALSE;
|
||||
start_in_quotes = kFalse;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1987,7 +1990,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|
||||
break;
|
||||
if ((((int)pos.col - 1 - col) & 1) == 0) {
|
||||
inquote = !inquote;
|
||||
start_in_quotes = FALSE;
|
||||
start_in_quotes = kFalse;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2039,7 +2042,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
|
||||
|
||||
/* Check for match outside of quotes, and inside of
|
||||
* quotes when the start is also inside of quotes. */
|
||||
if ((!inquote || start_in_quotes == TRUE)
|
||||
if ((!inquote || start_in_quotes == kTrue)
|
||||
&& (c == initc || c == findc)) {
|
||||
int col, bslcnt = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user