aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-12 18:31:59 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-12 21:22:06 -0500
commit5d6ecfa3c7447009da75842c611ea1b9f1db83e7 (patch)
treebe2a450a71101292ba5608fb2846f8340ad1f5f4 /src/nvim/ex_cmds.c
parent93c18867a0e79bf71bffa9f8ce533f224d759ee5 (diff)
downloadrneovim-5d6ecfa3c7447009da75842c611ea1b9f1db83e7.tar.gz
rneovim-5d6ecfa3c7447009da75842c611ea1b9f1db83e7.tar.bz2
rneovim-5d6ecfa3c7447009da75842c611ea1b9f1db83e7.zip
vim-patch:8.1.0805: too many #ifdefs
Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 1. https://github.com/vim/vim/commit/135059724f140ceac889c9f8136bd1bf5c41d49d
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 17afb33059..b8a0c3184b 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -795,10 +795,7 @@ void ex_retab(exarg_T *eap)
if (ptr[col] == NUL)
break;
vcol += chartabsize(ptr + col, (colnr_T)vcol);
- if (has_mbyte)
- col += (*mb_ptr2len)(ptr + col);
- else
- ++col;
+ col += utfc_ptr2len(ptr + col);
}
if (new_line == NULL) /* out of memory */
break;
@@ -3465,7 +3462,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
int lastone;
long nmatch_tl = 0; // nr of lines matched below lnum
int do_again; // do it again after joining lines
- int skip_match = false;
+ bool skip_match = false;
linenr_T sub_firstlnum; // nr of first sub line
/*
@@ -3576,16 +3573,13 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
if (matchcol == prev_matchcol
&& regmatch.endpos[0].lnum == 0
&& matchcol == regmatch.endpos[0].col) {
- if (sub_firstline[matchcol] == NUL)
- /* We already were at the end of the line. Don't look
- * for a match in this line again. */
- skip_match = TRUE;
- else {
- /* search for a match at next column */
- if (has_mbyte)
- matchcol += mb_ptr2len(sub_firstline + matchcol);
- else
- ++matchcol;
+ if (sub_firstline[matchcol] == NUL) {
+ // We already were at the end of the line. Don't look
+ // for a match in this line again.
+ skip_match = true;
+ } else {
+ // search for a match at next column
+ matchcol += mb_ptr2len(sub_firstline + matchcol);
}
// match will be pushed to preview_lines, bring it into a proper state
current_match.start.col = matchcol;
@@ -3609,7 +3603,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
if (nmatch > 1) {
matchcol = (colnr_T)STRLEN(sub_firstline);
nmatch = 1;
- skip_match = TRUE;
+ skip_match = true;
}
sub_nsubs++;
did_sub = TRUE;
@@ -3779,7 +3773,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
* get stuck when pressing 'n'. */
if (nmatch > 1) {
matchcol = (colnr_T)STRLEN(sub_firstline);
- skip_match = TRUE;
+ skip_match = true;
}
goto skip;
}
@@ -3956,8 +3950,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
STRMOVE(new_start, p1 + 1);
p1 = new_start - 1;
}
- } else if (has_mbyte) {
- p1 += (*mb_ptr2len)(p1) - 1;
+ } else {
+ p1 += utfc_ptr2len(p1) - 1;
}
}
size_t new_endcol = STRLEN(new_start);