diff options
Diffstat (limited to 'src/nvim/search.c')
-rw-r--r-- | src/nvim/search.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index cb59eb6d04..6c974850ac 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -3239,35 +3239,41 @@ static int in_html_tag(int end_tag) /* We search forward until the cursor, because searching backwards is * very slow for DBCS encodings. */ - for (p = line; p < line + curwin->w_cursor.col; mb_ptr_adv(p)) + for (p = line; p < line + curwin->w_cursor.col; MB_PTR_ADV(p)) { if (*p == '>' || *p == '<') { lc = *p; lp = p; } - if (*p != '<') { /* check for '<' under cursor */ - if (lc != '<') - return FALSE; + } + if (*p != '<') { // check for '<' under cursor + if (lc != '<') { + return false; + } p = lp; } } else { for (p = line + curwin->w_cursor.col; p > line; ) { - if (*p == '<') /* find '<' under/before cursor */ + if (*p == '<') { // find '<' under/before cursor break; - mb_ptr_back(line, p); - if (*p == '>') /* find '>' before cursor */ + } + MB_PTR_BACK(line, p); + if (*p == '>') { // find '>' before cursor break; + } + } + if (*p != '<') { + return false; } - if (*p != '<') - return FALSE; } pos.lnum = curwin->w_cursor.lnum; pos.col = (colnr_T)(p - line); - mb_ptr_adv(p); - if (end_tag) - /* check that there is a '/' after the '<' */ + MB_PTR_ADV(p); + if (end_tag) { + // check that there is a '/' after the '<' return *p == '/'; + } /* check that there is no '/' after the '<' */ if (*p == '/') @@ -3371,8 +3377,10 @@ again: */ inc_cursor(); p = get_cursor_pos_ptr(); - for (cp = p; *cp != NUL && *cp != '>' && !ascii_iswhite(*cp); mb_ptr_adv(cp)) - ; + for (cp = p; + *cp != NUL && *cp != '>' && !ascii_iswhite(*cp); + MB_PTR_ADV(cp)) { + } len = (int)(cp - p); if (len == 0) { curwin->w_cursor = old_pos; |