aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-05-07 16:40:00 +0200
committerGitHub <noreply@github.com>2022-05-07 16:40:00 +0200
commit03471e292d48283379a397dadf902572de91b359 (patch)
treee0736597ec1b49250a128a58ae0f7e7e217c3f2f /src/nvim/screen.c
parenteccb9896894f0e092b8d3c2519eb81b2a3fb3cca (diff)
parent2a378e6e82cececb12339f2df51ffe107039d867 (diff)
downloadrneovim-03471e292d48283379a397dadf902572de91b359.tar.gz
rneovim-03471e292d48283379a397dadf902572de91b359.tar.bz2
rneovim-03471e292d48283379a397dadf902572de91b359.zip
Merge pull request #18425 from dundargoc/refactor/char_u/1
refactor: replace char_u variables and functions with char
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 07207b70d1..f3e627cc65 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -1858,8 +1858,8 @@ static int compute_foldcolumn(win_T *wp, int col)
static int line_putchar(buf_T *buf, LineState *s, schar_T *dest, int maxcells, bool rl, int vcol)
{
const char_u *p = (char_u *)s->p;
- int cells = utf_ptr2cells(p);
- int c_len = utfc_ptr2len(p);
+ int cells = utf_ptr2cells((char *)p);
+ int c_len = utfc_ptr2len((char *)p);
int u8c, u8cc[MAX_MCO];
if (cells > maxcells) {
return -1;
@@ -1886,7 +1886,7 @@ static int line_putchar(buf_T *buf, LineState *s, schar_T *dest, int maxcells, b
if (rl) {
pc = s->prev_c;
pc1 = s->prev_c1;
- nc = utf_ptr2char(p + c_len);
+ nc = utf_ptr2char((char *)p + c_len);
s->prev_c1 = u8cc[0];
} else {
pc = utfc_ptr2char(p + c_len, pcc);
@@ -2534,7 +2534,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
ptr = prev_ptr;
// If the character fits on the screen, don't need to skip it.
// Except for a TAB.
- if (utf_ptr2cells(ptr) >= c || *ptr == TAB) {
+ if (utf_ptr2cells((char *)ptr) >= c || *ptr == TAB) {
n_skip = v - vcol;
}
}
@@ -2958,7 +2958,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
// handle Visual or match highlighting in this line
if (vcol == fromcol
|| (vcol + 1 == fromcol && n_extra == 0
- && utf_ptr2cells(ptr) > 1)
+ && utf_ptr2cells((char *)ptr) > 1)
|| ((int)vcol_prev == fromcol_prev
&& vcol_prev < vcol // not at margin
&& vcol < tocol)) {
@@ -3058,7 +3058,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
mb_c = c;
// If the UTF-8 character is more than one byte:
// Decode it into "mb_c".
- mb_l = utfc_ptr2len(p_extra);
+ mb_l = utfc_ptr2len((char *)p_extra);
mb_utf8 = false;
if (mb_l > n_extra) {
mb_l = 1;
@@ -3111,7 +3111,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
mb_c = c;
// If the UTF-8 character is more than one byte: Decode it
// into "mb_c".
- mb_l = utfc_ptr2len(ptr);
+ mb_l = utfc_ptr2len((char *)ptr);
mb_utf8 = false;
if (mb_l > 1) {
mb_c = utfc_ptr2char(ptr, u8cc);
@@ -3169,7 +3169,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
if (wp->w_p_rl) {
pc = prev_c;
pc1 = prev_c1;
- nc = utf_ptr2char(ptr + mb_l);
+ nc = utf_ptr2char((char *)ptr + mb_l);
prev_c1 = u8cc[0];
} else {
pc = utfc_ptr2char(ptr + mb_l, pcc);
@@ -5072,7 +5072,7 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
for (; *s != NUL; ++s) {
s += skip_status_match_char(xp, s);
clen += ptr2cells(s);
- if ((l = utfc_ptr2len(s)) > 1) {
+ if ((l = utfc_ptr2len((char *)s)) > 1) {
STRNCPY(buf + len, s, l); // NOLINT(runtime/printf)
s += l - 1;
len += l;
@@ -5232,8 +5232,8 @@ static void win_redr_status(win_T *wp)
// Find first character that will fit.
// Going from start to end is much faster for DBCS.
for (i = 0; p[i] != NUL && clen >= this_ru_col - 1;
- i += utfc_ptr2len(p + i)) {
- clen -= utf_ptr2cells(p + i);
+ i += utfc_ptr2len((char *)p + i)) {
+ clen -= utf_ptr2cells((char *)p + i);
}
len = clen;
if (i > 0) {
@@ -5883,7 +5883,7 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col
if (len > 0) {
mbyte_blen = utfc_ptr2len_len(ptr, (int)((text + len) - ptr));
} else {
- mbyte_blen = utfc_ptr2len(ptr);
+ mbyte_blen = utfc_ptr2len((char *)ptr);
}
if (len >= 0) {
u8c = utfc_ptr2char_len(ptr, u8cc, (int)((text + len) - ptr));
@@ -6506,7 +6506,7 @@ void setcursor(void)
// With 'rightleft' set and the cursor on a double-wide character,
// position it on the leftmost column.
col = curwin->w_width_inner - curwin->w_wcol
- - ((utf_ptr2cells(get_cursor_pos_ptr()) == 2
+ - ((utf_ptr2cells((char *)get_cursor_pos_ptr()) == 2
&& vim_isprintc(gchar_cursor())) ? 2 : 1);
}
@@ -7371,8 +7371,8 @@ static void win_redr_ruler(win_T *wp, bool always)
}
// Truncate at window boundary.
o = 0;
- for (i = 0; buffer[i] != NUL; i += utfc_ptr2len(buffer + i)) {
- o += utf_ptr2cells(buffer + i);
+ for (i = 0; buffer[i] != NUL; i += utfc_ptr2len((char *)buffer + i)) {
+ o += utf_ptr2cells((char *)buffer + i);
if (this_ru_col + o > width) {
buffer[i] = NUL;
break;