mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
refactor: replace char_u with char
Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
@@ -2622,7 +2622,7 @@ void may_clear_cmdline(void)
|
||||
|
||||
// Routines for displaying a partly typed command
|
||||
#define SHOWCMD_BUFLEN (SHOWCMD_COLS + 1 + 30)
|
||||
static char_u showcmd_buf[SHOWCMD_BUFLEN];
|
||||
static char showcmd_buf[SHOWCMD_BUFLEN];
|
||||
static char_u old_showcmd_buf[SHOWCMD_BUFLEN]; // For push_showcmd()
|
||||
static bool showcmd_is_clear = true;
|
||||
static bool showcmd_visual = false;
|
||||
@@ -2662,10 +2662,10 @@ void clear_showcmd(void)
|
||||
getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);
|
||||
p_sbr = saved_sbr;
|
||||
curwin->w_p_sbr = saved_w_sbr;
|
||||
snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64 "x%" PRId64,
|
||||
snprintf(showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64 "x%" PRId64,
|
||||
(int64_t)lines, (int64_t)rightcol - leftcol + 1);
|
||||
} else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum) {
|
||||
snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64, (int64_t)lines);
|
||||
snprintf(showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64, (int64_t)lines);
|
||||
} else {
|
||||
char_u *s, *e;
|
||||
int l;
|
||||
@@ -2691,9 +2691,9 @@ void clear_showcmd(void)
|
||||
s += l;
|
||||
}
|
||||
if (bytes == chars) {
|
||||
sprintf((char *)showcmd_buf, "%d", chars);
|
||||
snprintf(showcmd_buf, SHOWCMD_BUFLEN, "%d", chars);
|
||||
} else {
|
||||
sprintf((char *)showcmd_buf, "%d-%d", chars, bytes);
|
||||
snprintf(showcmd_buf, SHOWCMD_BUFLEN, "%d-%d", chars, bytes);
|
||||
}
|
||||
}
|
||||
int limit = ui_has(kUIMessages) ? SHOWCMD_BUFLEN - 1 : SHOWCMD_COLS;
|
||||
@@ -2783,7 +2783,7 @@ static void del_from_showcmd(int len)
|
||||
return;
|
||||
}
|
||||
|
||||
old_len = (int)STRLEN(showcmd_buf);
|
||||
old_len = (int)strlen(showcmd_buf);
|
||||
if (len > old_len) {
|
||||
len = old_len;
|
||||
}
|
||||
@@ -2822,7 +2822,7 @@ static void display_showcmd(void)
|
||||
}
|
||||
|
||||
int len;
|
||||
len = (int)STRLEN(showcmd_buf);
|
||||
len = (int)strlen(showcmd_buf);
|
||||
showcmd_is_clear = (len == 0);
|
||||
|
||||
if (ui_has(kUIMessages)) {
|
||||
@@ -2831,7 +2831,7 @@ static void display_showcmd(void)
|
||||
if (len > 0) {
|
||||
// placeholder for future highlight support
|
||||
ADD_C(chunk, INTEGER_OBJ(0));
|
||||
ADD_C(chunk, STRING_OBJ(cstr_as_string((char *)showcmd_buf)));
|
||||
ADD_C(chunk, STRING_OBJ(cstr_as_string(showcmd_buf)));
|
||||
ADD_C(content, ARRAY_OBJ(chunk));
|
||||
}
|
||||
ui_call_msg_showcmd(content);
|
||||
@@ -2843,7 +2843,7 @@ static void display_showcmd(void)
|
||||
grid_puts_line_start(&msg_grid_adj, showcmd_row);
|
||||
|
||||
if (!showcmd_is_clear) {
|
||||
grid_puts(&msg_grid_adj, (char *)showcmd_buf, showcmd_row, sc_col,
|
||||
grid_puts(&msg_grid_adj, showcmd_buf, showcmd_row, sc_col,
|
||||
HL_ATTR(HLF_MSG));
|
||||
}
|
||||
|
||||
@@ -4360,7 +4360,7 @@ static void nv_ident(cmdarg_T *cap)
|
||||
aux_ptr = "\\|\"\n*?[";
|
||||
}
|
||||
|
||||
p = buf + STRLEN(buf);
|
||||
p = buf + strlen(buf);
|
||||
while (n-- > 0) {
|
||||
// put a backslash before \ and some others
|
||||
if (vim_strchr(aux_ptr, *ptr) != NULL) {
|
||||
@@ -5295,7 +5295,7 @@ static void nv_kundo(cmdarg_T *cap)
|
||||
/// Handle the "r" command.
|
||||
static void nv_replace(cmdarg_T *cap)
|
||||
{
|
||||
char_u *ptr;
|
||||
char *ptr;
|
||||
int had_ctrl_v;
|
||||
|
||||
if (checkclearop(cap->oap)) {
|
||||
@@ -5358,9 +5358,9 @@ static void nv_replace(cmdarg_T *cap)
|
||||
}
|
||||
|
||||
// Abort if not enough characters to replace.
|
||||
ptr = (char_u *)get_cursor_pos_ptr();
|
||||
if (STRLEN(ptr) < (unsigned)cap->count1
|
||||
|| (mb_charlen(ptr) < cap->count1)) {
|
||||
ptr = get_cursor_pos_ptr();
|
||||
if (strlen(ptr) < (unsigned)cap->count1
|
||||
|| (mb_charlen((char_u *)ptr) < cap->count1)) {
|
||||
clearopbeep(cap->oap);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user