Merge pull request #10541 from bfredl/conversion_getln
refactor: enable -Wconversion for ex_getln.c and use int for Rows/Columns
This commit is contained in:
commit
d5f7099be2
|
@ -139,7 +139,6 @@ set(CONV_SOURCES
|
|||
eval.c
|
||||
ex_cmds.c
|
||||
ex_docmd.c
|
||||
ex_getln.c
|
||||
fileio.c
|
||||
mbyte.c
|
||||
memline.c
|
||||
|
|
|
@ -1497,8 +1497,8 @@ int get_digraph(int cmdline)
|
|||
}
|
||||
|
||||
if (cmdline) {
|
||||
if ((char2cells(c) == 1) && (cmdline_star == 0)) {
|
||||
putcmdline(c, TRUE);
|
||||
if ((char2cells(c) == 1) && c < 128 && (cmdline_star == 0)) {
|
||||
putcmdline((char)c, true);
|
||||
}
|
||||
} else {
|
||||
add_to_showcmd(c);
|
||||
|
|
|
@ -10026,13 +10026,13 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||
|
||||
if (strcmp(tv_get_string(&argvars[1]), "cmdline") == 0) {
|
||||
set_one_cmd_context(&xpc, tv_get_string(&argvars[0]));
|
||||
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
|
||||
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
|
||||
goto theend;
|
||||
}
|
||||
|
||||
ExpandInit(&xpc);
|
||||
xpc.xp_pattern = (char_u *)tv_get_string(&argvars[0]);
|
||||
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
|
||||
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
|
||||
xpc.xp_context = cmdcomplete_str_to_type(
|
||||
(char_u *)tv_get_string(&argvars[1]));
|
||||
if (xpc.xp_context == EXPAND_NOTHING) {
|
||||
|
@ -10042,17 +10042,17 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||
|
||||
if (xpc.xp_context == EXPAND_MENUS) {
|
||||
set_context_in_menu_cmd(&xpc, (char_u *)"menu", xpc.xp_pattern, false);
|
||||
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
|
||||
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
|
||||
}
|
||||
|
||||
if (xpc.xp_context == EXPAND_CSCOPE) {
|
||||
set_context_in_cscope_cmd(&xpc, (const char *)xpc.xp_pattern, CMD_cscope);
|
||||
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
|
||||
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
|
||||
}
|
||||
|
||||
if (xpc.xp_context == EXPAND_SIGN) {
|
||||
set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
|
||||
xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
|
||||
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
|
||||
}
|
||||
|
||||
theend:
|
||||
|
@ -21138,7 +21138,8 @@ void ex_function(exarg_T *eap)
|
|||
goto erret;
|
||||
}
|
||||
if (show_block) {
|
||||
ui_ext_cmdline_block_append(indent, (const char *)theline);
|
||||
assert(indent >= 0);
|
||||
ui_ext_cmdline_block_append((size_t)indent, (const char *)theline);
|
||||
}
|
||||
|
||||
/* Detect line continuation: sourcing_lnum increased more than one. */
|
||||
|
|
|
@ -1230,7 +1230,7 @@ static void do_filter(
|
|||
|
||||
/* Create the shell command in allocated memory. */
|
||||
cmd_buf = make_filter_cmd(cmd, itmp, otmp);
|
||||
ui_cursor_goto((int)Rows - 1, 0);
|
||||
ui_cursor_goto(Rows - 1, 0);
|
||||
|
||||
if (do_out) {
|
||||
if (u_save((linenr_T)(line2), (linenr_T)(line2 + 1)) == FAIL) {
|
||||
|
|
|
@ -143,7 +143,7 @@ struct exarg {
|
|||
struct expand {
|
||||
int xp_context; // type of expansion
|
||||
char_u *xp_pattern; // start of item to expand
|
||||
int xp_pattern_len; // bytes in xp_pattern before cursor
|
||||
size_t xp_pattern_len; // bytes in xp_pattern before cursor
|
||||
char_u *xp_arg; // completion function
|
||||
int xp_scriptID; // SID for completion function
|
||||
int xp_backslash; // one of the XP_BS_ values
|
||||
|
|
|
@ -6417,7 +6417,7 @@ static void ex_stop(exarg_T *eap)
|
|||
apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, false, NULL);
|
||||
|
||||
// TODO(bfredl): the TUI should do this on suspend
|
||||
ui_cursor_goto((int)Rows - 1, 0);
|
||||
ui_cursor_goto(Rows - 1, 0);
|
||||
ui_call_grid_scroll(1, 0, Rows, 0, Columns, 1, 0);
|
||||
ui_flush();
|
||||
ui_call_suspend(); // call machine specific function
|
||||
|
|
|
@ -279,6 +279,8 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
|
|||
s->old_topfill = curwin->w_topfill;
|
||||
s->old_botline = curwin->w_botline;
|
||||
|
||||
assert(indent >= 0);
|
||||
|
||||
// set some variables for redrawcmd()
|
||||
ccline.cmdfirstc = (s->firstc == '@' ? 0 : s->firstc);
|
||||
ccline.cmdindent = (s->firstc > 0 ? s->indent : 0);
|
||||
|
@ -294,7 +296,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
|
|||
|
||||
// autoindent for :insert and :append
|
||||
if (s->firstc <= 0) {
|
||||
memset(ccline.cmdbuff, ' ', s->indent);
|
||||
memset(ccline.cmdbuff, ' ', (size_t)s->indent);
|
||||
ccline.cmdbuff[s->indent] = NUL;
|
||||
ccline.cmdpos = s->indent;
|
||||
ccline.cmdspos = s->indent;
|
||||
|
@ -382,7 +384,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
|
|||
bool tl_ret = true;
|
||||
dict_T *dict = get_vim_var_dict(VV_EVENT);
|
||||
char firstcbuf[2];
|
||||
firstcbuf[0] = firstc > 0 ? firstc : '-';
|
||||
firstcbuf[0] = (char)(firstc > 0 ? firstc : '-');
|
||||
firstcbuf[1] = 0;
|
||||
|
||||
if (has_event(EVENT_CMDLINEENTER)) {
|
||||
|
@ -676,7 +678,7 @@ static int command_line_execute(VimState *state, int key)
|
|||
// Hitting <Down> after "emenu Name.": complete submenu
|
||||
if (s->c == K_DOWN && ccline.cmdpos > 0
|
||||
&& ccline.cmdbuff[ccline.cmdpos - 1] == '.') {
|
||||
s->c = p_wc;
|
||||
s->c = (int)p_wc;
|
||||
} else if (s->c == K_UP) {
|
||||
// Hitting <Up>: Remove one submenu name in front of the
|
||||
// cursor
|
||||
|
@ -706,7 +708,7 @@ static int command_line_execute(VimState *state, int key)
|
|||
if (i > 0) {
|
||||
cmdline_del(i);
|
||||
}
|
||||
s->c = p_wc;
|
||||
s->c = (int)p_wc;
|
||||
s->xpc.xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
}
|
||||
|
@ -728,7 +730,7 @@ static int command_line_execute(VimState *state, int key)
|
|||
|| ccline.cmdbuff[ccline.cmdpos - 2] != '.'
|
||||
|| ccline.cmdbuff[ccline.cmdpos - 3] != '.')) {
|
||||
// go down a directory
|
||||
s->c = p_wc;
|
||||
s->c = (int)p_wc;
|
||||
} else if (STRNCMP(s->xpc.xp_pattern, upseg + 1, 3) == 0
|
||||
&& s->c == K_DOWN) {
|
||||
// If in a direct ancestor, strip off one ../ to go down
|
||||
|
@ -748,7 +750,7 @@ static int command_line_execute(VimState *state, int key)
|
|||
&& ccline.cmdbuff[j - 2] == '.'
|
||||
&& (vim_ispathsep(ccline.cmdbuff[j - 3]) || j == i + 2)) {
|
||||
cmdline_del(j - 2);
|
||||
s->c = p_wc;
|
||||
s->c = (int)p_wc;
|
||||
}
|
||||
} else if (s->c == K_UP) {
|
||||
// go up a directory
|
||||
|
@ -795,7 +797,7 @@ static int command_line_execute(VimState *state, int key)
|
|||
|
||||
// Now complete in the new directory. Set KeyTyped in case the
|
||||
// Up key came from a mapping.
|
||||
s->c = p_wc;
|
||||
s->c = (int)p_wc;
|
||||
KeyTyped = true;
|
||||
}
|
||||
}
|
||||
|
@ -1633,7 +1635,7 @@ static int command_line_handle_key(CommandLineState *s)
|
|||
if (p[j] == old_firstc
|
||||
&& (j == 0 || p[j - 1] != '\\')) {
|
||||
if (i > 0) {
|
||||
ccline.cmdbuff[len] = s->firstc;
|
||||
ccline.cmdbuff[len] = (char_u)s->firstc;
|
||||
}
|
||||
} else {
|
||||
// Escape new sep, unless it is already
|
||||
|
@ -1789,7 +1791,7 @@ static int command_line_changed(CommandLineState *s)
|
|||
dict_T *dict = get_vim_var_dict(VV_EVENT);
|
||||
|
||||
char firstcbuf[2];
|
||||
firstcbuf[0] = s->firstc > 0 ? s->firstc : '-';
|
||||
firstcbuf[0] = (char)(s->firstc > 0 ? s->firstc : '-');
|
||||
firstcbuf[1] = 0;
|
||||
|
||||
// set v:event to a dictionary with information about the commandline
|
||||
|
@ -2297,8 +2299,10 @@ add_indent:
|
|||
char_u *s = skipwhite(p);
|
||||
|
||||
// Insert spaces after leading whitespaces.
|
||||
memmove(s + num_spaces, s, line_ga.ga_len - (s - p) + 1);
|
||||
memset(s, ' ', num_spaces);
|
||||
long move_len = line_ga.ga_len - (s - p) + 1;
|
||||
assert(move_len >= 0);
|
||||
memmove(s + num_spaces, s, (size_t)move_len);
|
||||
memset(s, ' ', (size_t)num_spaces);
|
||||
|
||||
line_ga.ga_len += num_spaces;
|
||||
}
|
||||
|
@ -2351,8 +2355,10 @@ redraw:
|
|||
while ((old_indent = get_indent_str(p, 8, FALSE)) > indent) {
|
||||
*--to = NUL;
|
||||
}
|
||||
memmove(to, from, line_ga.ga_len - (from - p) + 1);
|
||||
line_ga.ga_len -= from - to;
|
||||
long move_len = line_ga.ga_len - (from - p) + 1;
|
||||
assert(move_len > 0);
|
||||
memmove(to, from, (size_t)move_len);
|
||||
line_ga.ga_len -= (int)(from - to);
|
||||
|
||||
// Removed to much indentation, fix it before redrawing.
|
||||
num_spaces = indent - old_indent;
|
||||
|
@ -2458,7 +2464,7 @@ static void alloc_cmdbuff(int len)
|
|||
else
|
||||
len += 20;
|
||||
|
||||
ccline.cmdbuff = xmalloc(len);
|
||||
ccline.cmdbuff = xmalloc((size_t)len);
|
||||
ccline.cmdbufflen = len;
|
||||
}
|
||||
|
||||
|
@ -2535,26 +2541,28 @@ static void color_expr_cmdline(const CmdlineInfo *const colored_ccline,
|
|||
size_t prev_end = 0;
|
||||
for (size_t i = 0 ; i < kv_size(colors) ; i++) {
|
||||
const ParserHighlightChunk chunk = kv_A(colors, i);
|
||||
assert(chunk.start.col < INT_MAX);
|
||||
assert(chunk.end_col < INT_MAX);
|
||||
if (chunk.start.col != prev_end) {
|
||||
kv_push(ret_ccline_colors->colors, ((CmdlineColorChunk) {
|
||||
.start = prev_end,
|
||||
.end = chunk.start.col,
|
||||
.start = (int)prev_end,
|
||||
.end = (int)chunk.start.col,
|
||||
.attr = 0,
|
||||
}));
|
||||
}
|
||||
const int id = syn_name2id((const char_u *)chunk.group);
|
||||
const int attr = (id == 0 ? 0 : syn_id2attr(id));
|
||||
kv_push(ret_ccline_colors->colors, ((CmdlineColorChunk) {
|
||||
.start = chunk.start.col,
|
||||
.end = chunk.end_col,
|
||||
.start = (int)chunk.start.col,
|
||||
.end = (int)chunk.end_col,
|
||||
.attr = attr,
|
||||
}));
|
||||
prev_end = chunk.end_col;
|
||||
}
|
||||
if (prev_end < (size_t)colored_ccline->cmdlen) {
|
||||
kv_push(ret_ccline_colors->colors, ((CmdlineColorChunk) {
|
||||
.start = prev_end,
|
||||
.end = (size_t)colored_ccline->cmdlen,
|
||||
.start = (int)prev_end,
|
||||
.end = colored_ccline->cmdlen,
|
||||
.attr = 0,
|
||||
}));
|
||||
}
|
||||
|
@ -2719,8 +2727,8 @@ static bool color_cmdline(CmdlineInfo *colored_ccline)
|
|||
}
|
||||
if (start != prev_end) {
|
||||
kv_push(ccline_colors->colors, ((CmdlineColorChunk) {
|
||||
.start = prev_end,
|
||||
.end = start,
|
||||
.start = (int)prev_end,
|
||||
.end = (int)start,
|
||||
.attr = 0,
|
||||
}));
|
||||
}
|
||||
|
@ -2749,15 +2757,15 @@ static bool color_cmdline(CmdlineInfo *colored_ccline)
|
|||
const int id = syn_name2id((char_u *)group);
|
||||
const int attr = (id == 0 ? 0 : syn_id2attr(id));
|
||||
kv_push(ccline_colors->colors, ((CmdlineColorChunk) {
|
||||
.start = start,
|
||||
.end = end,
|
||||
.start = (int)start,
|
||||
.end = (int)end,
|
||||
.attr = attr,
|
||||
}));
|
||||
i++;
|
||||
});
|
||||
if (prev_end < colored_ccline->cmdlen) {
|
||||
kv_push(ccline_colors->colors, ((CmdlineColorChunk) {
|
||||
.start = prev_end,
|
||||
.start = (int)prev_end,
|
||||
.end = colored_ccline->cmdlen,
|
||||
.attr = 0,
|
||||
}));
|
||||
|
@ -2835,15 +2843,16 @@ static void draw_cmdline(int start, int len)
|
|||
goto draw_cmdline_no_arabicshape;
|
||||
}
|
||||
|
||||
static int buflen = 0;
|
||||
static size_t buflen = 0;
|
||||
assert(len >= 0);
|
||||
|
||||
// Do arabic shaping into a temporary buffer. This is very
|
||||
// inefficient!
|
||||
if (len * 2 + 2 > buflen) {
|
||||
if ((size_t)len * 2 + 2 > buflen) {
|
||||
// Re-allocate the buffer. We keep it around to avoid a lot of
|
||||
// alloc()/free() calls.
|
||||
xfree(arshape_buf);
|
||||
buflen = len * 2 + 2;
|
||||
buflen = (size_t)len * 2 + 2;
|
||||
arshape_buf = xmalloc(buflen);
|
||||
}
|
||||
|
||||
|
@ -2901,7 +2910,7 @@ static void draw_cmdline(int start, int len)
|
|||
}
|
||||
} else {
|
||||
prev_c = u8c;
|
||||
memmove(arshape_buf + newlen, p, mb_l);
|
||||
memmove(arshape_buf + newlen, p, (size_t)mb_l);
|
||||
newlen += mb_l;
|
||||
}
|
||||
}
|
||||
|
@ -2946,8 +2955,9 @@ static void ui_ext_cmdline_show(CmdlineInfo *line)
|
|||
Array item = ARRAY_DICT_INIT;
|
||||
ADD(item, INTEGER_OBJ(chunk.attr));
|
||||
|
||||
assert(chunk.end >= chunk.start);
|
||||
ADD(item, STRING_OBJ(cbuf_to_string((char *)line->cmdbuff + chunk.start,
|
||||
chunk.end-chunk.start)));
|
||||
(size_t)(chunk.end-chunk.start))));
|
||||
ADD(content, ARRAY_OBJ(item));
|
||||
}
|
||||
} else {
|
||||
|
@ -2968,7 +2978,7 @@ static void ui_ext_cmdline_show(CmdlineInfo *line)
|
|||
}
|
||||
}
|
||||
|
||||
void ui_ext_cmdline_block_append(int indent, const char *line)
|
||||
void ui_ext_cmdline_block_append(size_t indent, const char *line)
|
||||
{
|
||||
char *buf = xmallocz(indent + strlen(line));
|
||||
memset(buf, ' ', indent);
|
||||
|
@ -3047,7 +3057,7 @@ void cmdline_ui_flush(void)
|
|||
* right when "shift" is TRUE. Used for CTRL-V, CTRL-K, etc.
|
||||
* "c" must be printable (fit in one display cell)!
|
||||
*/
|
||||
void putcmdline(int c, int shift)
|
||||
void putcmdline(char c, int shift)
|
||||
{
|
||||
if (cmd_silent) {
|
||||
return;
|
||||
|
@ -3366,8 +3376,9 @@ void cmdline_paste_str(char_u *s, int literally)
|
|||
/// Delete characters on the command line, from "from" to the current position.
|
||||
static void cmdline_del(int from)
|
||||
{
|
||||
assert(ccline.cmdpos <= ccline.cmdlen);
|
||||
memmove(ccline.cmdbuff + from, ccline.cmdbuff + ccline.cmdpos,
|
||||
(size_t)ccline.cmdlen - ccline.cmdpos + 1);
|
||||
(size_t)ccline.cmdlen - (size_t)ccline.cmdpos + 1);
|
||||
ccline.cmdlen -= ccline.cmdpos - from;
|
||||
ccline.cmdpos = from;
|
||||
}
|
||||
|
@ -3488,15 +3499,17 @@ static void cursorcmd(void)
|
|||
}
|
||||
|
||||
if (cmdmsg_rl) {
|
||||
msg_row = cmdline_row + (ccline.cmdspos / (int)(Columns - 1));
|
||||
msg_col = (int)Columns - (ccline.cmdspos % (int)(Columns - 1)) - 1;
|
||||
if (msg_row <= 0)
|
||||
msg_row = cmdline_row + (ccline.cmdspos / (Columns - 1));
|
||||
msg_col = Columns - (ccline.cmdspos % (Columns - 1)) - 1;
|
||||
if (msg_row <= 0) {
|
||||
msg_row = Rows - 1;
|
||||
}
|
||||
} else {
|
||||
msg_row = cmdline_row + (ccline.cmdspos / (int)Columns);
|
||||
msg_col = ccline.cmdspos % (int)Columns;
|
||||
if (msg_row >= Rows)
|
||||
msg_row = cmdline_row + (ccline.cmdspos / Columns);
|
||||
msg_col = ccline.cmdspos % Columns;
|
||||
if (msg_row >= Rows) {
|
||||
msg_row = Rows - 1;
|
||||
}
|
||||
}
|
||||
|
||||
ui_cursor_goto(msg_row, msg_col);
|
||||
|
@ -3598,7 +3611,8 @@ nextwild (
|
|||
}
|
||||
|
||||
i = (int)(xp->xp_pattern - ccline.cmdbuff);
|
||||
xp->xp_pattern_len = ccline.cmdpos - i;
|
||||
assert(ccline.cmdpos >= i);
|
||||
xp->xp_pattern_len = (size_t)ccline.cmdpos - (size_t)i;
|
||||
|
||||
if (type == WILD_NEXT || type == WILD_PREV) {
|
||||
// Get next/previous match for a previous expanded pattern.
|
||||
|
@ -3618,7 +3632,7 @@ nextwild (
|
|||
xfree(p1);
|
||||
// Longest match: make sure it is not shorter, happens with :help.
|
||||
if (p2 != NULL && type == WILD_LONGEST) {
|
||||
for (j = 0; j < xp->xp_pattern_len; j++) {
|
||||
for (j = 0; (size_t)j < xp->xp_pattern_len; j++) {
|
||||
if (ccline.cmdbuff[i + j] == '*'
|
||||
|| ccline.cmdbuff[i + j] == '?') {
|
||||
break;
|
||||
|
@ -3631,14 +3645,15 @@ nextwild (
|
|||
}
|
||||
|
||||
if (p2 != NULL && !got_int) {
|
||||
difflen = (int)STRLEN(p2) - xp->xp_pattern_len;
|
||||
difflen = (int)STRLEN(p2) - (int)xp->xp_pattern_len;
|
||||
if (ccline.cmdlen + difflen + 4 > ccline.cmdbufflen) {
|
||||
realloc_cmdbuff(ccline.cmdlen + difflen + 4);
|
||||
xp->xp_pattern = ccline.cmdbuff + i;
|
||||
}
|
||||
assert(ccline.cmdpos <= ccline.cmdlen);
|
||||
memmove(&ccline.cmdbuff[ccline.cmdpos + difflen],
|
||||
&ccline.cmdbuff[ccline.cmdpos],
|
||||
(size_t)ccline.cmdlen - ccline.cmdpos + 1);
|
||||
(size_t)ccline.cmdlen - (size_t)ccline.cmdpos + 1);
|
||||
memmove(&ccline.cmdbuff[i], p2, STRLEN(p2));
|
||||
ccline.cmdlen += difflen;
|
||||
ccline.cmdpos += difflen;
|
||||
|
@ -3835,7 +3850,7 @@ ExpandOne (
|
|||
size_t len = 0;
|
||||
|
||||
for (size_t mb_len; xp->xp_files[0][len]; len += mb_len) {
|
||||
mb_len = utfc_ptr2len(&xp->xp_files[0][len]);
|
||||
mb_len = (size_t)utfc_ptr2len(&xp->xp_files[0][len]);
|
||||
int c0 = utf_ptr2char(&xp->xp_files[0][len]);
|
||||
for (i = 1; i < xp->xp_numfiles; i++) {
|
||||
int ci = utf_ptr2char(&xp->xp_files[i][len]);
|
||||
|
@ -4107,17 +4122,19 @@ static int showmatches(expand_T *xp, int wildmenu)
|
|||
|| ui_has(kUIWildmenu);
|
||||
|
||||
if (compl_use_pum) {
|
||||
assert(num_files >= 0);
|
||||
compl_match_arraysize = num_files;
|
||||
compl_match_array = xcalloc(compl_match_arraysize, sizeof(pumitem_T));
|
||||
compl_match_array = xcalloc((size_t)compl_match_arraysize,
|
||||
sizeof(pumitem_T));
|
||||
for (i = 0; i < num_files; i++) {
|
||||
compl_match_array[i].pum_text = L_SHOWFILE(i);
|
||||
}
|
||||
char_u *endpos = (showtail
|
||||
? sm_gettail(xp->xp_pattern, true) : xp->xp_pattern);
|
||||
if (ui_has(kUICmdline)) {
|
||||
compl_startcol = endpos - ccline.cmdbuff;
|
||||
compl_startcol = (int)(endpos - ccline.cmdbuff);
|
||||
} else {
|
||||
compl_startcol = cmd_screencol(endpos - ccline.cmdbuff);
|
||||
compl_startcol = cmd_screencol((int)(endpos - ccline.cmdbuff));
|
||||
}
|
||||
compl_selected = -1;
|
||||
cmdline_pum_display(true);
|
||||
|
@ -4153,14 +4170,15 @@ static int showmatches(expand_T *xp, int wildmenu)
|
|||
maxlen = j;
|
||||
}
|
||||
|
||||
if (xp->xp_context == EXPAND_TAGS_LISTFILES)
|
||||
if (xp->xp_context == EXPAND_TAGS_LISTFILES) {
|
||||
lines = num_files;
|
||||
else {
|
||||
/* compute the number of columns and lines for the listing */
|
||||
maxlen += 2; /* two spaces between file names */
|
||||
columns = ((int)Columns + 2) / maxlen;
|
||||
if (columns < 1)
|
||||
} else {
|
||||
// compute the number of columns and lines for the listing
|
||||
maxlen += 2; // two spaces between file names
|
||||
columns = (Columns + 2) / maxlen;
|
||||
if (columns < 1) {
|
||||
columns = 1;
|
||||
}
|
||||
lines = (num_files + columns - 1) / columns;
|
||||
}
|
||||
|
||||
|
@ -4306,24 +4324,20 @@ static int expand_showtail(expand_T *xp)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare a string for expansion.
|
||||
* When expanding file names: The string will be used with expand_wildcards().
|
||||
* Copy "fname[len]" into allocated memory and add a '*' at the end.
|
||||
* When expanding other names: The string will be used with regcomp(). Copy
|
||||
* the name into allocated memory and prepend "^".
|
||||
*/
|
||||
char_u *
|
||||
addstar (
|
||||
char_u *fname,
|
||||
int len,
|
||||
int context /* EXPAND_FILES etc. */
|
||||
)
|
||||
/// Prepare a string for expansion.
|
||||
///
|
||||
/// When expanding file names: The string will be used with expand_wildcards().
|
||||
/// Copy "fname[len]" into allocated memory and add a '*' at the end.
|
||||
/// When expanding other names: The string will be used with regcomp(). Copy
|
||||
/// the name into allocated memory and prepend "^".
|
||||
///
|
||||
/// @param context EXPAND_FILES etc.
|
||||
char_u *addstar(char_u *fname, size_t len, int context)
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
char_u *retval;
|
||||
int i, j;
|
||||
int new_len;
|
||||
size_t i, j;
|
||||
size_t new_len;
|
||||
char_u *tail;
|
||||
int ends_in_star;
|
||||
|
||||
|
@ -4414,9 +4428,10 @@ addstar (
|
|||
tail = path_tail(retval);
|
||||
ends_in_star = (len > 0 && retval[len - 1] == '*');
|
||||
#ifndef BACKSLASH_IN_FILENAME
|
||||
for (i = len - 2; i >= 0; --i) {
|
||||
if (retval[i] != '\\')
|
||||
for (ssize_t k = (ssize_t)len - 2; k >= 0; k--) {
|
||||
if (retval[k] != '\\') {
|
||||
break;
|
||||
}
|
||||
ends_in_star = !ends_in_star;
|
||||
}
|
||||
#endif
|
||||
|
@ -4497,7 +4512,7 @@ set_cmd_context (
|
|||
int use_ccline // use ccline for info
|
||||
)
|
||||
{
|
||||
int old_char = NUL;
|
||||
char_u old_char = NUL;
|
||||
|
||||
/*
|
||||
* Avoid a UMR warning from Purify, only save the character if it has been
|
||||
|
@ -4561,8 +4576,9 @@ expand_cmdline (
|
|||
return EXPAND_NOTHING;
|
||||
}
|
||||
|
||||
/* add star to file name, or convert to regexp if not exp. files. */
|
||||
xp->xp_pattern_len = (int)(str + col - xp->xp_pattern);
|
||||
// add star to file name, or convert to regexp if not exp. files.
|
||||
assert((str + col) - xp->xp_pattern >= 0);
|
||||
xp->xp_pattern_len = (size_t)((str + col) - xp->xp_pattern);
|
||||
file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
|
||||
|
||||
if (p_wic)
|
||||
|
@ -4852,7 +4868,7 @@ void ExpandGeneric(
|
|||
)
|
||||
{
|
||||
int i;
|
||||
int count = 0;
|
||||
size_t count = 0;
|
||||
char_u *str;
|
||||
|
||||
// count the number of matching names
|
||||
|
@ -4868,7 +4884,8 @@ void ExpandGeneric(
|
|||
}
|
||||
if (count == 0)
|
||||
return;
|
||||
*num_file = count;
|
||||
assert(count < INT_MAX);
|
||||
*num_file = (int)count;
|
||||
*file = (char_u **)xmalloc(count * sizeof(char_u *));
|
||||
|
||||
// copy the matching names into allocated memory
|
||||
|
@ -4989,9 +5006,10 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
|
|||
if (e == NULL)
|
||||
e = s + STRLEN(s);
|
||||
|
||||
l = e - s;
|
||||
if (l > MAXPATHL - 5)
|
||||
l = (size_t)(e - s);
|
||||
if (l > MAXPATHL - 5) {
|
||||
break;
|
||||
}
|
||||
STRLCPY(buf, s, l + 1);
|
||||
add_pathsep((char *)buf);
|
||||
l = STRLEN(buf);
|
||||
|
@ -5032,7 +5050,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
|
|||
static void * call_user_expand_func(user_expand_func_T user_expand_func,
|
||||
expand_T *xp, int *num_file, char_u ***file)
|
||||
{
|
||||
int keep = 0;
|
||||
char_u keep = 0;
|
||||
char_u num[50];
|
||||
char_u *args[3];
|
||||
int save_current_SID = current_SID;
|
||||
|
@ -5094,14 +5112,14 @@ static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file,
|
|||
e = vim_strchr(s, '\n');
|
||||
if (e == NULL)
|
||||
e = s + STRLEN(s);
|
||||
const int keep = *e;
|
||||
const char_u keep = *e;
|
||||
*e = NUL;
|
||||
|
||||
const bool skip = xp->xp_pattern[0]
|
||||
&& vim_regexec(regmatch, s, (colnr_T)0) == 0;
|
||||
*e = keep;
|
||||
if (!skip) {
|
||||
GA_APPEND(char_u *, &ga, vim_strnsave(s, (int)(e - s)));
|
||||
GA_APPEND(char_u *, &ga, vim_strnsave(s, (size_t)(e - s)));
|
||||
}
|
||||
|
||||
if (*e != NUL) {
|
||||
|
@ -5203,7 +5221,8 @@ static int ExpandRTDir(char_u *pat, int flags, int *num_file, char_u ***file,
|
|||
}
|
||||
s++;
|
||||
*e = NUL;
|
||||
memmove(match, s, e - s + 1);
|
||||
assert((e - s) + 1 >= 0);
|
||||
memmove(match, s, (size_t)(e - s) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5239,8 +5258,7 @@ static int ExpandPackAddDir(char_u *pat, int *num_file, char_u ***file)
|
|||
for (int i = 0; i < ga.ga_len; i++) {
|
||||
char_u *match = ((char_u **)ga.ga_data)[i];
|
||||
s = path_tail(match);
|
||||
char_u *e = s + STRLEN(s);
|
||||
memmove(match, s, e - s + 1);
|
||||
memmove(match, s, STRLEN(s)+1);
|
||||
}
|
||||
|
||||
if (GA_EMPTY(&ga)) {
|
||||
|
@ -5384,7 +5402,9 @@ void init_history(void)
|
|||
// On copying them to the new arrays, we take the chance to reorder them.
|
||||
if (newlen != oldlen) {
|
||||
for (int type = 0; type < HIST_COUNT; type++) {
|
||||
histentry_T *temp = newlen ? xmalloc(newlen * sizeof(*temp)) : NULL;
|
||||
histentry_T *temp = (newlen
|
||||
? xmalloc((size_t)newlen * sizeof(*temp))
|
||||
: NULL);
|
||||
|
||||
int j = hisidx[type];
|
||||
if (j >= 0) {
|
||||
|
@ -5549,7 +5569,6 @@ add_to_history (
|
|||
)
|
||||
{
|
||||
histentry_T *hisptr;
|
||||
int len;
|
||||
|
||||
if (hislen == 0 || histype == HIST_INVALID) { // no history
|
||||
return;
|
||||
|
@ -5581,12 +5600,12 @@ add_to_history (
|
|||
hisptr = &history[histype][hisidx[histype]];
|
||||
hist_free_entry(hisptr);
|
||||
|
||||
/* Store the separator after the NUL of the string. */
|
||||
len = (int)STRLEN(new_entry);
|
||||
// Store the separator after the NUL of the string.
|
||||
size_t len = STRLEN(new_entry);
|
||||
hisptr->hisstr = vim_strnsave(new_entry, len + 2);
|
||||
hisptr->timestamp = os_time();
|
||||
hisptr->additional_elements = NULL;
|
||||
hisptr->hisstr[len + 1] = sep;
|
||||
hisptr->hisstr[len + 1] = (char_u)sep;
|
||||
|
||||
hisptr->hisnum = ++hisnum[histype];
|
||||
if (histype == HIST_SEARCH && in_map)
|
||||
|
@ -5640,7 +5659,7 @@ char_u *get_cmdline_str(void)
|
|||
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
return vim_strnsave(p->cmdbuff, p->cmdlen);
|
||||
return vim_strnsave(p->cmdbuff, (size_t)p->cmdlen);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5909,7 +5928,7 @@ void ex_history(exarg_T *eap)
|
|||
while (ASCII_ISALPHA(*end)
|
||||
|| vim_strchr((char_u *)":=@>/?", *end) != NULL)
|
||||
end++;
|
||||
histype1 = get_histtype((const char *)arg, end - arg, false);
|
||||
histype1 = get_histtype((const char *)arg, (size_t)(end - arg), false);
|
||||
if (histype1 == HIST_INVALID) {
|
||||
if (STRNICMP(arg, "all", end - arg) == 0) {
|
||||
histype1 = 0;
|
||||
|
@ -5948,13 +5967,14 @@ void ex_history(exarg_T *eap)
|
|||
if (hist[i].hisstr != NULL
|
||||
&& hist[i].hisnum >= j && hist[i].hisnum <= k) {
|
||||
msg_putchar('\n');
|
||||
sprintf((char *)IObuff, "%c%6d ", i == idx ? '>' : ' ',
|
||||
hist[i].hisnum);
|
||||
if (vim_strsize(hist[i].hisstr) > (int)Columns - 10)
|
||||
snprintf((char *)IObuff, IOSIZE, "%c%6d ", i == idx ? '>' : ' ',
|
||||
hist[i].hisnum);
|
||||
if (vim_strsize(hist[i].hisstr) > Columns - 10) {
|
||||
trunc_string(hist[i].hisstr, IObuff + STRLEN(IObuff),
|
||||
(int)Columns - 10, IOSIZE - (int)STRLEN(IObuff));
|
||||
else
|
||||
Columns - 10, IOSIZE - (int)STRLEN(IObuff));
|
||||
} else {
|
||||
STRCAT(IObuff, hist[i].hisstr);
|
||||
}
|
||||
msg_outtrans(IObuff);
|
||||
ui_flush();
|
||||
}
|
||||
|
@ -6115,8 +6135,8 @@ static int open_cmdwin(void)
|
|||
State = NORMAL;
|
||||
setmouse();
|
||||
|
||||
/* Trigger CmdwinEnter autocommands. */
|
||||
typestr[0] = cmdwin_type;
|
||||
// Trigger CmdwinEnter autocommands.
|
||||
typestr[0] = (char_u)cmdwin_type;
|
||||
typestr[1] = NUL;
|
||||
apply_autocmds(EVENT_CMDWINENTER, typestr, typestr, FALSE, curbuf);
|
||||
if (restart_edit != 0) /* autocmd with ":startinsert" */
|
||||
|
|
|
@ -1928,7 +1928,7 @@ static int vgetorpeek(int advance)
|
|||
set_option_value("paste", !p_paste, NULL, 0);
|
||||
if (!(State & INSERT)) {
|
||||
msg_col = 0;
|
||||
msg_row = (int)Rows - 1;
|
||||
msg_row = Rows - 1;
|
||||
msg_clr_eos(); // clear ruler
|
||||
}
|
||||
status_redraw_all();
|
||||
|
@ -2273,14 +2273,13 @@ static int vgetorpeek(int advance)
|
|||
curwin->w_wrow = old_wrow;
|
||||
}
|
||||
|
||||
/* this looks nice when typing a dead character map */
|
||||
if ((State & CMDLINE)
|
||||
&& cmdline_star == 0
|
||||
&& ptr2cells(typebuf.tb_buf + typebuf.tb_off
|
||||
+ typebuf.tb_len - 1) == 1) {
|
||||
putcmdline(typebuf.tb_buf[typebuf.tb_off
|
||||
+ typebuf.tb_len - 1], FALSE);
|
||||
c1 = 1;
|
||||
// this looks nice when typing a dead character map
|
||||
if ((State & CMDLINE) && cmdline_star == 0) {
|
||||
char_u *p = typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len - 1;
|
||||
if (ptr2cells(p) == 1 && *p < 128) {
|
||||
putcmdline((char)(*p), false);
|
||||
c1 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,18 +88,15 @@ EXTERN struct nvim_stats_s {
|
|||
#define NO_BUFFERS 1 // not all buffers loaded yet
|
||||
// 0 not starting anymore
|
||||
|
||||
/*
|
||||
* Number of Rows and Columns in the screen.
|
||||
* Must be long to be able to use them as options in option.c.
|
||||
* Note: Use default_grid.Rows and default_grid.Columns to access items in
|
||||
* default_grid.chars[]. They may have different values when the screen
|
||||
* wasn't (re)allocated yet after setting Rows or Columns (e.g., when starting
|
||||
* up).
|
||||
*/
|
||||
// Number of Rows and Columns in the screen.
|
||||
// Note: Use default_grid.Rows and default_grid.Columns to access items in
|
||||
// default_grid.chars[]. They may have different values when the screen
|
||||
// wasn't (re)allocated yet after setting Rows or Columns (e.g., when starting
|
||||
// up).
|
||||
#define DFLT_COLS 80 // default value for 'columns'
|
||||
#define DFLT_ROWS 24 // default value for 'lines'
|
||||
EXTERN long Rows INIT(= DFLT_ROWS); // nr of rows in the screen
|
||||
EXTERN long Columns INIT(= DFLT_COLS); // nr of columns in the screen
|
||||
EXTERN int Rows INIT(= DFLT_ROWS); // nr of rows in the screen
|
||||
EXTERN int Columns INIT(= DFLT_COLS); // nr of columns in the screen
|
||||
|
||||
// We use 64-bit file functions here, if available. E.g. ftello() returns
|
||||
// off_t instead of long, which helps if long is 32 bit and off_t is 64 bit.
|
||||
|
|
|
@ -582,9 +582,9 @@ static void prt_header(prt_settings_T *const psettings, const int pagenum,
|
|||
*/
|
||||
static void prt_message(char_u *s)
|
||||
{
|
||||
grid_fill(&default_grid, (int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ',
|
||||
0);
|
||||
grid_puts(&default_grid, s, (int)Rows - 1, 0, HL_ATTR(HLF_R));
|
||||
// TODO(bfredl): delete this
|
||||
grid_fill(&default_grid, Rows - 1, Rows, 0, Columns, ' ', ' ', 0);
|
||||
grid_puts(&default_grid, s, Rows - 1, 0, HL_ATTR(HLF_R));
|
||||
ui_flush();
|
||||
}
|
||||
|
||||
|
|
|
@ -1648,7 +1648,7 @@ static void cs_print_tags_priv(char **matches, char **cntxts,
|
|||
assert(buf_len >= 0);
|
||||
|
||||
// Print the context only if it fits on the same line.
|
||||
if (msg_col + buf_len >= (int)Columns) {
|
||||
if (msg_col + buf_len >= Columns) {
|
||||
msg_putchar('\n');
|
||||
}
|
||||
msg_advance(12);
|
||||
|
|
|
@ -589,8 +589,8 @@ void getout(int exitval)
|
|||
|
||||
set_vim_var_nr(VV_EXITING, exitval);
|
||||
|
||||
/* Position the cursor on the last screen line, below all the text */
|
||||
ui_cursor_goto((int)Rows - 1, 0);
|
||||
// Position the cursor on the last screen line, below all the text
|
||||
ui_cursor_goto(Rows - 1, 0);
|
||||
|
||||
/* Optionally print hashtable efficiency. */
|
||||
hash_debug_results();
|
||||
|
@ -656,8 +656,8 @@ void getout(int exitval)
|
|||
wait_return(FALSE);
|
||||
}
|
||||
|
||||
/* Position the cursor again, the autocommands may have moved it */
|
||||
ui_cursor_goto((int)Rows - 1, 0);
|
||||
// Position the cursor again, the autocommands may have moved it
|
||||
ui_cursor_goto(Rows - 1, 0);
|
||||
|
||||
// Apply 'titleold'.
|
||||
if (p_title && *p_titleold != NUL) {
|
||||
|
|
|
@ -846,11 +846,11 @@ void curs_columns(
|
|||
|
||||
prev_skipcol = curwin->w_skipcol;
|
||||
|
||||
int p_lines = 0;
|
||||
int plines = 0;
|
||||
if ((curwin->w_wrow >= curwin->w_height_inner
|
||||
|| ((prev_skipcol > 0
|
||||
|| curwin->w_wrow + p_so >= curwin->w_height_inner)
|
||||
&& (p_lines =
|
||||
&& (plines =
|
||||
plines_win_nofill(curwin, curwin->w_cursor.lnum, false)) - 1
|
||||
>= curwin->w_height_inner))
|
||||
&& curwin->w_height_inner != 0
|
||||
|
@ -869,20 +869,21 @@ void curs_columns(
|
|||
extra = 1;
|
||||
/* Compute last display line of the buffer line that we want at the
|
||||
* bottom of the window. */
|
||||
if (p_lines == 0)
|
||||
p_lines = plines_win(curwin, curwin->w_cursor.lnum, false);
|
||||
--p_lines;
|
||||
if (p_lines > curwin->w_wrow + p_so) {
|
||||
if (plines == 0) {
|
||||
plines = plines_win(curwin, curwin->w_cursor.lnum, false);
|
||||
}
|
||||
plines--;
|
||||
if (plines > curwin->w_wrow + p_so) {
|
||||
assert(p_so <= INT_MAX);
|
||||
n = curwin->w_wrow + (int)p_so;
|
||||
} else {
|
||||
n = plines;
|
||||
}
|
||||
else
|
||||
n = p_lines;
|
||||
if ((colnr_T)n >= curwin->w_height_inner + curwin->w_skipcol / width) {
|
||||
extra += 2;
|
||||
}
|
||||
|
||||
if (extra == 3 || p_lines < p_so * 2) {
|
||||
if (extra == 3 || plines < p_so * 2) {
|
||||
// not enough room for 'scrolloff', put cursor in the middle
|
||||
n = curwin->w_virtcol / width;
|
||||
if (n > curwin->w_height_inner / 2) {
|
||||
|
@ -891,8 +892,8 @@ void curs_columns(
|
|||
n = 0;
|
||||
}
|
||||
// don't skip more than necessary
|
||||
if (n > p_lines - curwin->w_height_inner + 1) {
|
||||
n = p_lines - curwin->w_height_inner + 1;
|
||||
if (n > plines - curwin->w_height_inner + 1) {
|
||||
n = plines - curwin->w_height_inner + 1;
|
||||
}
|
||||
curwin->w_skipcol = n * width;
|
||||
} else if (extra == 1) {
|
||||
|
|
|
@ -3451,7 +3451,7 @@ static void display_showcmd(void)
|
|||
return;
|
||||
}
|
||||
|
||||
int showcmd_row = (int)Rows - 1;
|
||||
int showcmd_row = Rows - 1;
|
||||
grid_puts_line_start(&default_grid, showcmd_row);
|
||||
|
||||
if (!showcmd_is_clear) {
|
||||
|
|
|
@ -3433,7 +3433,7 @@ void ex_display(exarg_T *eap)
|
|||
msg_putchar(name);
|
||||
MSG_PUTS(" ");
|
||||
|
||||
int n = (int)Columns - 6;
|
||||
int n = Columns - 6;
|
||||
for (size_t j = 0; j < yb->y_size && n > 1; j++) {
|
||||
if (j) {
|
||||
MSG_PUTS_ATTR("^J", attr);
|
||||
|
@ -3525,7 +3525,7 @@ dis_msg (
|
|||
int n;
|
||||
int l;
|
||||
|
||||
n = (int)Columns - 6;
|
||||
n = Columns - 6;
|
||||
while (*p != NUL
|
||||
&& !(*p == ESC && skip_esc && *(p + 1) == NUL)
|
||||
&& (n -= ptr2cells(p)) >= 0) {
|
||||
|
|
|
@ -4165,7 +4165,6 @@ static char *set_num_option(int opt_idx, char_u *varp, long value,
|
|||
char_u *errmsg = NULL;
|
||||
long old_value = *(long *)varp;
|
||||
long old_Rows = Rows; // remember old Rows
|
||||
long old_Columns = Columns; // remember old Columns
|
||||
long *pp = (long *)varp;
|
||||
|
||||
// Disallow changing some options from secure mode.
|
||||
|
@ -4432,36 +4431,41 @@ static char *set_num_option(int opt_idx, char_u *varp, long value,
|
|||
|
||||
|
||||
// Check the (new) bounds for Rows and Columns here.
|
||||
if (Rows < min_rows() && full_screen) {
|
||||
if (p_lines < min_rows() && full_screen) {
|
||||
if (errbuf != NULL) {
|
||||
vim_snprintf((char *)errbuf, errbuflen,
|
||||
_("E593: Need at least %d lines"), min_rows());
|
||||
errmsg = errbuf;
|
||||
}
|
||||
Rows = min_rows();
|
||||
p_lines = min_rows();
|
||||
}
|
||||
if (Columns < MIN_COLUMNS && full_screen) {
|
||||
if (p_columns < MIN_COLUMNS && full_screen) {
|
||||
if (errbuf != NULL) {
|
||||
vim_snprintf((char *)errbuf, errbuflen,
|
||||
_("E594: Need at least %d columns"), MIN_COLUMNS);
|
||||
errmsg = errbuf;
|
||||
}
|
||||
Columns = MIN_COLUMNS;
|
||||
p_columns = MIN_COLUMNS;
|
||||
}
|
||||
limit_screen_size();
|
||||
|
||||
// True max size is defined by check_shellsize()
|
||||
p_lines = MIN(p_lines, INT_MAX);
|
||||
p_columns = MIN(p_columns, INT_MAX);
|
||||
|
||||
// If the screen (shell) height has been changed, assume it is the
|
||||
// physical screenheight.
|
||||
if (old_Rows != Rows || old_Columns != Columns) {
|
||||
if (p_lines != Rows || p_columns != Columns) {
|
||||
// Changing the screen size is not allowed while updating the screen.
|
||||
if (updating_screen) {
|
||||
*pp = old_value;
|
||||
} else if (full_screen) {
|
||||
screen_resize((int)Columns, (int)Rows);
|
||||
screen_resize((int)p_columns, (int)p_lines);
|
||||
} else {
|
||||
// TODO(bfredl): is this branch ever needed?
|
||||
// Postpone the resizing; check the size and cmdline position for
|
||||
// messages.
|
||||
Rows = (int)p_lines;
|
||||
Columns = (int)p_columns;
|
||||
check_shellsize();
|
||||
if (cmdline_row > Rows - p_ch && Rows > p_ch) {
|
||||
assert(p_ch >= 0 && Rows - p_ch <= INT_MAX);
|
||||
|
@ -5079,8 +5083,8 @@ showoptions(
|
|||
* display the items
|
||||
*/
|
||||
if (run == 1) {
|
||||
assert(Columns <= LONG_MAX - GAP
|
||||
&& Columns + GAP >= LONG_MIN + 3
|
||||
assert(Columns <= INT_MAX - GAP
|
||||
&& Columns + GAP >= INT_MIN + 3
|
||||
&& (Columns + GAP - 3) / INC >= INT_MIN
|
||||
&& (Columns + GAP - 3) / INC <= INT_MAX);
|
||||
cols = (int)((Columns + GAP - 3) / INC);
|
||||
|
|
|
@ -366,6 +366,7 @@ static char *(p_cb_values[]) = {"unnamed", "unnamedplus", NULL};
|
|||
# define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS)
|
||||
EXTERN long p_cwh; // 'cmdwinheight'
|
||||
EXTERN long p_ch; // 'cmdheight'
|
||||
EXTERN long p_columns; // 'columns'
|
||||
EXTERN int p_confirm; // 'confirm'
|
||||
EXTERN int p_cp; // 'compatible'
|
||||
EXTERN char_u *p_cot; // 'completeopt'
|
||||
|
@ -476,6 +477,7 @@ EXTERN char_u *p_langmap; // 'langmap'
|
|||
EXTERN int p_lnr; // 'langnoremap'
|
||||
EXTERN int p_lrm; // 'langremap'
|
||||
EXTERN char_u *p_lm; // 'langmenu'
|
||||
EXTERN long p_lines; // 'lines'
|
||||
EXTERN long p_linespace; // 'linespace'
|
||||
EXTERN char_u *p_lispwords; // 'lispwords'
|
||||
EXTERN long p_ls; // 'laststatus'
|
||||
|
|
|
@ -379,10 +379,9 @@ return {
|
|||
full_name='columns', abbreviation='co',
|
||||
type='number', scope={'global'},
|
||||
no_mkrc=true,
|
||||
nodefault=true,
|
||||
vi_def=true,
|
||||
redraw={'everything'},
|
||||
varname='Columns',
|
||||
varname='p_columns',
|
||||
defaults={if_true={vi=macros('DFLT_COLS')}}
|
||||
},
|
||||
{
|
||||
|
@ -1384,10 +1383,9 @@ return {
|
|||
full_name='lines',
|
||||
type='number', scope={'global'},
|
||||
no_mkrc=true,
|
||||
nodefault=true,
|
||||
vi_def=true,
|
||||
redraw={'everything'},
|
||||
varname='Rows',
|
||||
varname='p_lines',
|
||||
defaults={if_true={vi=macros('DFLT_ROWS')}}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -321,10 +321,10 @@ static unsigned int handle_mouse_event(char **ptr, uint8_t *buf,
|
|||
// Make sure the mouse position is valid. Some terminals may
|
||||
// return weird values.
|
||||
if (col >= Columns) {
|
||||
col = (int)Columns - 1;
|
||||
col = Columns - 1;
|
||||
}
|
||||
if (row >= Rows) {
|
||||
row = (int)Rows - 1;
|
||||
row = Rows - 1;
|
||||
}
|
||||
mouse_grid = 0;
|
||||
mouse_row = row;
|
||||
|
|
|
@ -369,10 +369,7 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
|||
// With interactive completion, the error message is not printed.
|
||||
if (!(flags & EW_SILENT)) {
|
||||
msg_putchar('\n'); // clear bottom line quickly
|
||||
#if SIZEOF_LONG > SIZEOF_INT
|
||||
assert(Rows <= (long)INT_MAX + 1);
|
||||
#endif
|
||||
cmdline_row = (int)(Rows - 1); // continue on last line
|
||||
cmdline_row = Rows - 1; // continue on last line
|
||||
MSG(_(e_wildexpand));
|
||||
msg_start(); // don't overwrite this message
|
||||
}
|
||||
|
|
|
@ -2654,7 +2654,7 @@ static void qf_msg(qf_info_T *qi, int which, char *lead)
|
|||
}
|
||||
xstrlcat((char *)buf, title, IOSIZE);
|
||||
}
|
||||
trunc_string(buf, buf, (int)Columns - 1, IOSIZE);
|
||||
trunc_string(buf, buf, Columns - 1, IOSIZE);
|
||||
msg(buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -341,8 +341,7 @@ int update_screen(int type)
|
|||
type = CLEAR;
|
||||
} else if (type != CLEAR) {
|
||||
check_for_delay(false);
|
||||
grid_ins_lines(&default_grid, 0, msg_scrolled, (int)Rows,
|
||||
0, (int)Columns);
|
||||
grid_ins_lines(&default_grid, 0, msg_scrolled, Rows, 0, Columns);
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||
if (wp->w_floating) {
|
||||
continue;
|
||||
|
@ -1463,7 +1462,7 @@ static void win_update(win_T *wp)
|
|||
// Last line isn't finished: Display "@@@" in the last screen line.
|
||||
grid_puts_len(&wp->w_grid, (char_u *)"@@", 2, scr_row, 0, at_attr);
|
||||
|
||||
grid_fill(&wp->w_grid, scr_row, scr_row + 1, 2, (int)wp->w_grid.Columns,
|
||||
grid_fill(&wp->w_grid, scr_row, scr_row + 1, 2, wp->w_grid.Columns,
|
||||
'@', ' ', at_attr);
|
||||
set_empty_rows(wp, srow);
|
||||
wp->w_botline = lnum;
|
||||
|
@ -4820,7 +4819,7 @@ win_redr_status_matches (
|
|||
grid_puts(&default_grid, selstart, row, selstart_col, HL_ATTR(HLF_WM));
|
||||
}
|
||||
|
||||
grid_fill(&default_grid, row, row + 1, clen, (int)Columns,
|
||||
grid_fill(&default_grid, row, row + 1, clen, Columns,
|
||||
fillchar, fillchar, attr);
|
||||
}
|
||||
|
||||
|
@ -6805,13 +6804,11 @@ static void draw_tabline(void)
|
|||
c = '_';
|
||||
else
|
||||
c = ' ';
|
||||
grid_fill(&default_grid, 0, 1, col, (int)Columns, c, c,
|
||||
attr_fill);
|
||||
grid_fill(&default_grid, 0, 1, col, Columns, c, c, attr_fill);
|
||||
|
||||
/* Put an "X" for closing the current tab if there are several. */
|
||||
if (first_tabpage->tp_next != NULL) {
|
||||
grid_putchar(&default_grid, 'X', 0, (int)Columns - 1,
|
||||
attr_nosel);
|
||||
grid_putchar(&default_grid, 'X', 0, Columns - 1, attr_nosel);
|
||||
tab_page_click_defs[Columns - 1] = (StlClickDefinition) {
|
||||
.type = kStlClickTabClose,
|
||||
.tabnr = 999,
|
||||
|
@ -7174,6 +7171,8 @@ void screen_resize(int width, int height)
|
|||
check_shellsize();
|
||||
height = Rows;
|
||||
width = Columns;
|
||||
p_lines = Rows;
|
||||
p_columns = Columns;
|
||||
ui_call_grid_resize(1, width, height);
|
||||
|
||||
send_grid_resize = true;
|
||||
|
|
|
@ -2130,8 +2130,8 @@ static void version_msg(char *s)
|
|||
int len = (int)STRLEN(s);
|
||||
|
||||
if (!got_int
|
||||
&& (len < (int)Columns)
|
||||
&& (msg_col + len >= (int)Columns)
|
||||
&& (len < Columns)
|
||||
&& (msg_col + len >= Columns)
|
||||
&& (*s != '\n')) {
|
||||
msg_putchar('\n');
|
||||
}
|
||||
|
|
|
@ -1892,8 +1892,8 @@ void win_equal(
|
|||
if (dir == 0)
|
||||
dir = *p_ead;
|
||||
win_equal_rec(next_curwin == NULL ? curwin : next_curwin, current,
|
||||
topframe, dir, 0, tabline_height(),
|
||||
(int)Columns, topframe->fr_height);
|
||||
topframe, dir, 0, tabline_height(),
|
||||
Columns, topframe->fr_height);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4742,9 +4742,10 @@ void shell_new_columns(void)
|
|||
|
||||
/* First try setting the widths of windows with 'winfixwidth'. If that
|
||||
* doesn't result in the right width, forget about that option. */
|
||||
frame_new_width(topframe, (int)Columns, FALSE, TRUE);
|
||||
if (!frame_check_width(topframe, Columns))
|
||||
frame_new_width(topframe, (int)Columns, FALSE, FALSE);
|
||||
frame_new_width(topframe, Columns, false, true);
|
||||
if (!frame_check_width(topframe, Columns)) {
|
||||
frame_new_width(topframe, Columns, false, false);
|
||||
}
|
||||
|
||||
(void)win_comp_pos(); /* recompute w_winrow and w_wincol */
|
||||
}
|
||||
|
@ -4890,7 +4891,7 @@ void win_setheight_win(int height, win_T *win)
|
|||
// If there is extra space created between the last window and the command
|
||||
// line, clear it.
|
||||
if (full_screen && msg_scrolled == 0 && row < cmdline_row) {
|
||||
grid_fill(&default_grid, row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
|
||||
grid_fill(&default_grid, row, cmdline_row, 0, Columns, ' ', ' ', 0);
|
||||
}
|
||||
cmdline_row = row;
|
||||
msg_row = row;
|
||||
|
@ -5352,7 +5353,7 @@ void win_drag_status_line(win_T *dragwin, int offset)
|
|||
fr = fr->fr_next;
|
||||
}
|
||||
row = win_comp_pos();
|
||||
grid_fill(&default_grid, row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
|
||||
grid_fill(&default_grid, row, cmdline_row, 0, Columns, ' ', ' ', 0);
|
||||
cmdline_row = row;
|
||||
p_ch = Rows - cmdline_row;
|
||||
if (p_ch < 1)
|
||||
|
@ -5721,8 +5722,7 @@ void command_height(void)
|
|||
|
||||
// clear the lines added to cmdline
|
||||
if (full_screen) {
|
||||
grid_fill(&default_grid, cmdline_row, (int)Rows, 0, (int)Columns, ' ',
|
||||
' ', 0);
|
||||
grid_fill(&default_grid, cmdline_row, Rows, 0, Columns, ' ', ' ', 0);
|
||||
}
|
||||
msg_row = cmdline_row;
|
||||
redraw_cmdline = TRUE;
|
||||
|
|
Loading…
Reference in New Issue