From 2bddc4ca54e31a14b7e9799beda134217ae867e7 Mon Sep 17 00:00:00 2001 From: ZviRackover Date: Wed, 15 Aug 2018 22:02:33 +0300 Subject: Remove occurences of mb_head_off --- src/nvim/normal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/normal.c') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 225fe4aa9a..0cd4486d40 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2858,7 +2858,7 @@ static void find_start_of_word(pos_T *pos) while (pos->col > 0) { col = pos->col - 1; - col -= (*mb_head_off)(line, line + col); + col -= utf_head_off(line, line + col); if (get_mouse_class(line + col) != cclass) break; pos->col = col; @@ -2878,7 +2878,7 @@ static void find_end_of_word(pos_T *pos) line = ml_get(pos->lnum); if (*p_sel == 'e' && pos->col > 0) { --pos->col; - pos->col -= (*mb_head_off)(line, line + pos->col); + pos->col -= utf_head_off(line, line + pos->col); } cclass = get_mouse_class(line + pos->col); while (line[pos->col] != NUL) { @@ -3062,7 +3062,7 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, /* Remember class of character under cursor. */ this_class = mb_get_class(ptr + col); while (col > 0 && this_class != 0) { - prevcol = col - 1 - (*mb_head_off)(ptr, ptr + col - 1); + prevcol = col - 1 - utf_head_off(ptr, ptr + col - 1); prev_class = mb_get_class(ptr + prevcol); if (this_class != prev_class && (i == 0 -- cgit From 30392b635689a5f25421c17ead79e521863c8b57 Mon Sep 17 00:00:00 2001 From: ZviRackover Date: Wed, 15 Aug 2018 22:46:48 +0300 Subject: Remove has_mbyte from lines near changes in parent commit --- src/nvim/normal.c | 56 +++++++++++++++++++------------------------------------ 1 file changed, 19 insertions(+), 37 deletions(-) (limited to 'src/nvim/normal.c') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 0cd4486d40..d36c0e42a4 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3058,47 +3058,29 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, /* * 2. Back up to start of identifier/string. */ - if (has_mbyte) { - /* Remember class of character under cursor. */ - this_class = mb_get_class(ptr + col); - while (col > 0 && this_class != 0) { - prevcol = col - 1 - utf_head_off(ptr, ptr + col - 1); - prev_class = mb_get_class(ptr + prevcol); - if (this_class != prev_class - && (i == 0 - || prev_class == 0 - || (find_type & FIND_IDENT)) - ) - break; - col = prevcol; - } - - /* If we don't want just any old string, or we've found an - * identifier, stop searching. */ - if (this_class > 2) - this_class = 2; - if (!(find_type & FIND_STRING) || this_class == 2) - break; - } else { - while (col > 0 - && ((i == 0 - ? vim_iswordc(ptr[col - 1]) - : (!ascii_iswhite(ptr[col - 1]) - && (!(find_type & FIND_IDENT) - || !vim_iswordc(ptr[col - 1])))) - )) - --col; - - /* If we don't want just any old string, or we've found an - * identifier, stop searching. */ - if (!(find_type & FIND_STRING) || vim_iswordc(ptr[col])) + /* Remember class of character under cursor. */ + this_class = mb_get_class(ptr + col); + while (col > 0 && this_class != 0) { + prevcol = col - 1 - utf_head_off(ptr, ptr + col - 1); + prev_class = mb_get_class(ptr + prevcol); + if (this_class != prev_class + && (i == 0 + || prev_class == 0 + || (find_type & FIND_IDENT)) + ) break; + col = prevcol; } + + /* If we don't want just any old string, or we've found an + * identifier, stop searching. */ + if (this_class > 2) + this_class = 2; + if (!(find_type & FIND_STRING) || this_class == 2) + break; } - if (ptr[col] == NUL || (i == 0 && ( - has_mbyte ? this_class != 2 : - !vim_iswordc(ptr[col])))) { + if (ptr[col] == NUL || (i == 0 && this_class != 2)) { /* * didn't find an identifier or string */ -- cgit From d110c6d7907d6f27f32b1d2bd91ffee7ef6097f4 Mon Sep 17 00:00:00 2001 From: ZviRackover Date: Thu, 16 Aug 2018 05:09:21 +0300 Subject: lint: cleanup after parent commits --- src/nvim/normal.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/nvim/normal.c') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index d36c0e42a4..8fdc660b68 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2859,8 +2859,9 @@ static void find_start_of_word(pos_T *pos) while (pos->col > 0) { col = pos->col - 1; col -= utf_head_off(line, line + col); - if (get_mouse_class(line + col) != cclass) + if (get_mouse_class(line + col) != cclass) { break; + } pos->col = col; } } @@ -2877,7 +2878,7 @@ static void find_end_of_word(pos_T *pos) line = ml_get(pos->lnum); if (*p_sel == 'e' && pos->col > 0) { - --pos->col; + pos->col--; pos->col -= utf_head_off(line, line + pos->col); } cclass = get_mouse_class(line + pos->col); @@ -3055,39 +3056,38 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, ++col; - /* - * 2. Back up to start of identifier/string. - */ - /* Remember class of character under cursor. */ + // + // 2. Back up to start of identifier/string. + // + // Remember class of character under cursor. this_class = mb_get_class(ptr + col); while (col > 0 && this_class != 0) { prevcol = col - 1 - utf_head_off(ptr, ptr + col - 1); prev_class = mb_get_class(ptr + prevcol); if (this_class != prev_class - && (i == 0 - || prev_class == 0 - || (find_type & FIND_IDENT)) - ) + && (i == 0 || prev_class == 0 || (find_type & FIND_IDENT))) { break; + } col = prevcol; } - /* If we don't want just any old string, or we've found an - * identifier, stop searching. */ - if (this_class > 2) + // If we don't want just any old string, or we've found an + // identifier, stop searching. + if (this_class > 2) { this_class = 2; - if (!(find_type & FIND_STRING) || this_class == 2) + } + if (!(find_type & FIND_STRING) || this_class == 2) { break; + } } if (ptr[col] == NUL || (i == 0 && this_class != 2)) { - /* - * didn't find an identifier or string - */ - if (find_type & FIND_STRING) + // Didn't find an identifier or string. + if (find_type & FIND_STRING) { EMSG(_("E348: No string under cursor")); - else + } else { EMSG(_(e_noident)); + } return 0; } ptr += col; -- cgit