From 691f4715c0cf4bc11ea2280db8777e6dd174a8ac Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Fri, 26 Aug 2022 23:11:25 +0200 Subject: refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459 --- src/nvim/screen.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 9c1064d608..3258dc11d6 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -734,13 +734,13 @@ int showmode(void) length = (Rows - msg_row) * Columns - 3; } if (edit_submode_extra != NULL) { - length -= vim_strsize((char *)edit_submode_extra); + length -= vim_strsize(edit_submode_extra); } if (length > 0) { if (edit_submode_pre != NULL) { - length -= vim_strsize((char *)edit_submode_pre); + length -= vim_strsize(edit_submode_pre); } - if (length - vim_strsize((char *)edit_submode) > 0) { + if (length - vim_strsize(edit_submode) > 0) { if (edit_submode_pre != NULL) { msg_puts_attr((const char *)edit_submode_pre, attr); } @@ -1026,7 +1026,7 @@ void draw_tabline(void) if (col + len >= Columns - 3) { break; } - grid_puts_len(&default_grid, NameBuff, len, 0, col, + grid_puts_len(&default_grid, (char_u *)NameBuff, len, 0, col, hl_combine_attr(attr, win_hl_attr(cwp, HLF_T))); col += len; } @@ -1040,9 +1040,9 @@ void draw_tabline(void) if (room > 0) { // Get buffer name in NameBuff[] get_trans_bufname(cwp->w_buffer); - shorten_dir(NameBuff); + shorten_dir((char_u *)NameBuff); len = vim_strsize((char *)NameBuff); - p = NameBuff; + p = (char_u *)NameBuff; while (len > room) { len -= ptr2cells((char *)p); MB_PTR_ADV(p); @@ -1295,13 +1295,13 @@ static int get_encoded_char_adv(const char_u **p) /// @param varp either the global or the window-local value. /// @param apply if false, do not store the flags, only check for errors. /// @return error message, NULL if it's OK. -char *set_chars_option(win_T *wp, char_u **varp, bool apply) +char *set_chars_option(win_T *wp, char **varp, bool apply) { const char_u *last_multispace = NULL; // Last occurrence of "multispace:" const char_u *last_lmultispace = NULL; // Last occurrence of "leadmultispace:" int multispace_len = 0; // Length of lcs-multispace string int lead_multispace_len = 0; // Length of lcs-leadmultispace string - const bool is_listchars = (varp == (char_u **)&p_lcs || varp == (char_u **)&wp->w_p_lcs); + const bool is_listchars = (varp == &p_lcs || varp == &wp->w_p_lcs); struct chars_tab { int *cp; ///< char value @@ -1344,17 +1344,17 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply) struct chars_tab *tab; int entries; - const char_u *value = *varp; + const char_u *value = (char_u *)(*varp); if (is_listchars) { tab = lcs_tab; entries = ARRAY_SIZE(lcs_tab); - if (varp == (char_u **)&wp->w_p_lcs && wp->w_p_lcs[0] == NUL) { + if (varp == &wp->w_p_lcs && wp->w_p_lcs[0] == NUL) { value = (char_u *)p_lcs; // local value is empty, use the global value } } else { tab = fcs_tab; entries = ARRAY_SIZE(fcs_tab); - if (varp == (char_u **)&wp->w_p_fcs && wp->w_p_fcs[0] == NUL) { + if (varp == &wp->w_p_fcs && wp->w_p_fcs[0] == NUL) { value = (char_u *)p_fcs; // local value is empty, use the global value } } @@ -1520,17 +1520,17 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply) /// @return an untranslated error message if any of them is invalid, NULL otherwise. char *check_chars_options(void) { - if (set_chars_option(curwin, (char_u **)&p_lcs, false) != NULL) { + if (set_chars_option(curwin, &p_lcs, false) != NULL) { return e_conflicts_with_value_of_listchars; } - if (set_chars_option(curwin, (char_u **)&p_fcs, false) != NULL) { + if (set_chars_option(curwin, &p_fcs, false) != NULL) { return e_conflicts_with_value_of_fillchars; } FOR_ALL_TAB_WINDOWS(tp, wp) { - if (set_chars_option(wp, (char_u **)&wp->w_p_lcs, true) != NULL) { + if (set_chars_option(wp, &wp->w_p_lcs, true) != NULL) { return e_conflicts_with_value_of_listchars; } - if (set_chars_option(wp, (char_u **)&wp->w_p_fcs, true) != NULL) { + if (set_chars_option(wp, &wp->w_p_fcs, true) != NULL) { return e_conflicts_with_value_of_fillchars; } } -- cgit From 58f30a326f34319801e7921f32c83e8320d85f6c Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Fri, 26 Aug 2022 23:11:25 +0200 Subject: refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459 --- src/nvim/screen.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 3258dc11d6..6efaae3725 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -277,7 +277,7 @@ static int wildmenu_match_len(expand_T *xp, char_u *s) /// These are backslashes used for escaping. Do show backslashes in help tags. static int skip_wildmenu_char(expand_T *xp, char_u *s) { - if ((rem_backslash(s) && xp->xp_context != EXPAND_HELP) + if ((rem_backslash((char *)s) && xp->xp_context != EXPAND_HELP) || ((xp->xp_context == EXPAND_MENUS || xp->xp_context == EXPAND_MENUNAMES) && (s[0] == '\t' @@ -469,10 +469,10 @@ void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int match, i ScreenGrid *grid = (wild_menu_showing == WM_SCROLLED) ? &msg_grid_adj : &default_grid; - grid_puts(grid, buf, row, 0, attr); + grid_puts(grid, (char *)buf, row, 0, attr); if (selstart != NULL && highlight) { *selend = NUL; - grid_puts(grid, selstart, row, selstart_col, HL_ATTR(HLF_WM)); + grid_puts(grid, (char *)selstart, row, selstart_col, HL_ATTR(HLF_WM)); } grid_fill(grid, row, row + 1, clen, Columns, @@ -1026,12 +1026,12 @@ void draw_tabline(void) if (col + len >= Columns - 3) { break; } - grid_puts_len(&default_grid, (char_u *)NameBuff, len, 0, col, + grid_puts_len(&default_grid, NameBuff, len, 0, col, hl_combine_attr(attr, win_hl_attr(cwp, HLF_T))); col += len; } if (modified) { - grid_puts_len(&default_grid, (char_u *)"+", 1, 0, col++, attr); + grid_puts_len(&default_grid, "+", 1, 0, col++, attr); } grid_putchar(&default_grid, ' ', 0, col++, attr); } @@ -1040,7 +1040,7 @@ void draw_tabline(void) if (room > 0) { // Get buffer name in NameBuff[] get_trans_bufname(cwp->w_buffer); - shorten_dir((char_u *)NameBuff); + shorten_dir(NameBuff); len = vim_strsize((char *)NameBuff); p = (char_u *)NameBuff; while (len > room) { @@ -1051,7 +1051,7 @@ void draw_tabline(void) len = Columns - col - 1; } - grid_puts_len(&default_grid, p, (int)STRLEN(p), 0, col, attr); + grid_puts_len(&default_grid, (char *)p, (int)STRLEN(p), 0, col, attr); col += len; } grid_putchar(&default_grid, ' ', 0, col++, attr); -- cgit From 2828aae7b49921380f229ebf4d7432f39c6c2c2b Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 30 Aug 2022 14:52:09 +0200 Subject: refactor: replace char_u with char 4 (#19987) * refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459 --- src/nvim/screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 6efaae3725..d268dde845 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1270,7 +1270,7 @@ static int get_encoded_char_adv(const char_u **p) int64_t num = 0; for (int bytes = s[1] == 'x' ? 1 : s[1] == 'u' ? 2 : 4; bytes > 0; bytes--) { *p += 2; - int n = hexhex2nr(*p); + int n = hexhex2nr((char *)(*p)); if (n < 0) { return 0; } -- cgit From 73207cae611a1efb8cd17139e8228772daeb9866 Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Fri, 26 Aug 2022 23:11:25 +0200 Subject: refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459 --- src/nvim/screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index d268dde845..8e10f2d62d 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -620,7 +620,7 @@ void setcursor_mayforce(bool force) // 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((char *)get_cursor_pos_ptr()) == 2 + - ((utf_ptr2cells(get_cursor_pos_ptr()) == 2 && vim_isprintc(gchar_cursor())) ? 2 : 1); } -- cgit