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