Refactor: remove mb_ptr2len_len, mb_ptr2cells and mb_ptr2cells_len

Remove occurences of these macros.
This commit is contained in:
ZviRackover
2018-08-29 21:15:32 +03:00
parent e30ccd56d9
commit 1c03a06487
10 changed files with 22 additions and 25 deletions

View File

@@ -1874,7 +1874,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
// Store multibyte characters in ScreenLines[] et al. correctly.
for (p = text; *p != NUL; ) {
cells = (*mb_ptr2cells)(p);
cells = utf_ptr2cells(p);
c_len = (*mb_ptr2len)(p);
if (col + cells > wp->w_width - (wp->w_p_rl ? col : 0)) {
break;
@@ -2915,7 +2915,7 @@ win_line (
/* handle Visual or match highlighting in this line */
if (vcol == fromcol
|| (has_mbyte && vcol + 1 == fromcol && n_extra == 0
&& (*mb_ptr2cells)(ptr) > 1)
&& utf_ptr2cells(ptr) > 1)
|| ((int)vcol_prev == fromcol_prev
&& vcol_prev < vcol /* not at margin */
&& vcol < tocol))
@@ -4880,7 +4880,7 @@ static void win_redr_status(win_T *wp, int ignore_pum)
// Going from start to end is much faster for DBCS.
for (i = 0; p[i] != NUL && clen >= this_ru_col - 1;
i += (*mb_ptr2len)(p + i)) {
clen -= (*mb_ptr2cells)(p + i);
clen -= utf_ptr2cells(p + i);
}
len = clen;
if (i > 0) {
@@ -6134,7 +6134,7 @@ void setcursor(void)
* character, position it on the leftmost column. */
curwin->w_p_rl ? (curwin->w_width - curwin->w_wcol - (
(has_mbyte
&& (*mb_ptr2cells)(get_cursor_pos_ptr()) == 2
&& utf_ptr2cells(get_cursor_pos_ptr()) == 2
&& vim_isprintc(gchar_cursor())) ? 2 :
1)) :
curwin->w_wcol));
@@ -6972,7 +6972,7 @@ static void win_redr_ruler(win_T *wp, int always)
if (has_mbyte) {
o = 0;
for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i)) {
o += (*mb_ptr2cells)(buffer + i);
o += utf_ptr2cells(buffer + i);
if (this_ru_col + o > width) {
buffer[i] = NUL;
break;