refactor: remove long

long is 32-bits even on 64-bit windows which makes the type suboptimal
for a codebase meant to be cross-platform.
This commit is contained in:
dundargoc 2023-09-26 22:36:08 +02:00 committed by dundargoc
parent 9afbfb4d64
commit af7d317f3f
33 changed files with 254 additions and 257 deletions

View File

@ -729,7 +729,7 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name,
"Option '%s' value is out of range", name.data, { "Option '%s' value is out of range", name.data, {
return; return;
}); });
optval = NUMBER_OPTVAL(value.data.integer); optval = NUMBER_OPTVAL((OptInt)value.data.integer);
} else { } else {
VALIDATE(value.type == kObjectTypeString, "Option '%s' value must be String", name.data, { VALIDATE(value.type == kObjectTypeString, "Option '%s' value must be String", name.data, {
return; return;

View File

@ -165,7 +165,7 @@ static OptVal object_as_optval(Object o, bool *error)
case kObjectTypeBoolean: case kObjectTypeBoolean:
return BOOLEAN_OPTVAL(o.data.boolean); return BOOLEAN_OPTVAL(o.data.boolean);
case kObjectTypeInteger: case kObjectTypeInteger:
return NUMBER_OPTVAL(o.data.integer); return NUMBER_OPTVAL((OptInt)o.data.integer);
case kObjectTypeString: case kObjectTypeString:
return STRING_OPTVAL(o.data.string); return STRING_OPTVAL(o.data.string);
default: default:

View File

@ -206,7 +206,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags_arg)
int flags = flags_arg; int flags = flags_arg;
int retval = OK; int retval = OK;
bufref_T old_curbuf; bufref_T old_curbuf;
long old_tw = curbuf->b_p_tw; OptInt old_tw = curbuf->b_p_tw;
int read_fifo = false; int read_fifo = false;
bool silent = shortmess(SHM_FILEINFO); bool silent = shortmess(SHM_FILEINFO);
@ -965,7 +965,7 @@ void goto_buffer(exarg_T *eap, int start, int dir, int count)
void handle_swap_exists(bufref_T *old_curbuf) void handle_swap_exists(bufref_T *old_curbuf)
{ {
cleanup_T cs; cleanup_T cs;
long old_tw = curbuf->b_p_tw; OptInt old_tw = curbuf->b_p_tw;
buf_T *buf; buf_T *buf;
if (swap_exists_action == SEA_QUIT) { if (swap_exists_action == SEA_QUIT) {
@ -1532,7 +1532,7 @@ void set_curbuf(buf_T *buf, int action)
buf_T *prevbuf; buf_T *prevbuf;
int unload = (action == DOBUF_UNLOAD || action == DOBUF_DEL int unload = (action == DOBUF_UNLOAD || action == DOBUF_DEL
|| action == DOBUF_WIPE); || action == DOBUF_WIPE);
long old_tw = curbuf->b_p_tw; OptInt old_tw = curbuf->b_p_tw;
setpcmark(); setpcmark();
if ((cmdmod.cmod_flags & CMOD_KEEPALT) == 0) { if ((cmdmod.cmod_flags & CMOD_KEEPALT) == 0) {

View File

@ -125,18 +125,18 @@ typedef struct {
#define w_p_fen_save w_onebuf_opt.wo_fen_save #define w_p_fen_save w_onebuf_opt.wo_fen_save
char *wo_fdi; char *wo_fdi;
#define w_p_fdi w_onebuf_opt.wo_fdi // 'foldignore' #define w_p_fdi w_onebuf_opt.wo_fdi // 'foldignore'
long wo_fdl; OptInt wo_fdl;
#define w_p_fdl w_onebuf_opt.wo_fdl // 'foldlevel' #define w_p_fdl w_onebuf_opt.wo_fdl // 'foldlevel'
long wo_fdl_save; OptInt wo_fdl_save;
// 'foldlevel' state saved for diff mode // 'foldlevel' state saved for diff mode
#define w_p_fdl_save w_onebuf_opt.wo_fdl_save #define w_p_fdl_save w_onebuf_opt.wo_fdl_save
char *wo_fdm; char *wo_fdm;
#define w_p_fdm w_onebuf_opt.wo_fdm // 'foldmethod' #define w_p_fdm w_onebuf_opt.wo_fdm // 'foldmethod'
char *wo_fdm_save; char *wo_fdm_save;
#define w_p_fdm_save w_onebuf_opt.wo_fdm_save // 'fdm' saved for diff mode #define w_p_fdm_save w_onebuf_opt.wo_fdm_save // 'fdm' saved for diff mode
long wo_fml; OptInt wo_fml;
#define w_p_fml w_onebuf_opt.wo_fml // 'foldminlines' #define w_p_fml w_onebuf_opt.wo_fml // 'foldminlines'
long wo_fdn; OptInt wo_fdn;
#define w_p_fdn w_onebuf_opt.wo_fdn // 'foldnestmax' #define w_p_fdn w_onebuf_opt.wo_fdn // 'foldnestmax'
char *wo_fde; char *wo_fde;
#define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr' #define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr'
@ -156,7 +156,7 @@ typedef struct {
#define w_p_ve w_onebuf_opt.wo_ve // 'virtualedit' #define w_p_ve w_onebuf_opt.wo_ve // 'virtualedit'
unsigned wo_ve_flags; unsigned wo_ve_flags;
#define w_ve_flags w_onebuf_opt.wo_ve_flags // flags for 'virtualedit' #define w_ve_flags w_onebuf_opt.wo_ve_flags // flags for 'virtualedit'
long wo_nuw; OptInt wo_nuw;
#define w_p_nuw w_onebuf_opt.wo_nuw // 'numberwidth' #define w_p_nuw w_onebuf_opt.wo_nuw // 'numberwidth'
int wo_wfh; int wo_wfh;
#define w_p_wfh w_onebuf_opt.wo_wfh // 'winfixheight' #define w_p_wfh w_onebuf_opt.wo_wfh // 'winfixheight'
@ -168,7 +168,7 @@ typedef struct {
#define w_p_rl w_onebuf_opt.wo_rl // 'rightleft' #define w_p_rl w_onebuf_opt.wo_rl // 'rightleft'
char *wo_rlc; char *wo_rlc;
#define w_p_rlc w_onebuf_opt.wo_rlc // 'rightleftcmd' #define w_p_rlc w_onebuf_opt.wo_rlc // 'rightleftcmd'
long wo_scr; OptInt wo_scr;
#define w_p_scr w_onebuf_opt.wo_scr // 'scroll' #define w_p_scr w_onebuf_opt.wo_scr // 'scroll'
int wo_sms; int wo_sms;
#define w_p_sms w_onebuf_opt.wo_sms // 'smoothscroll' #define w_p_sms w_onebuf_opt.wo_sms // 'smoothscroll'
@ -202,7 +202,7 @@ typedef struct {
#define w_p_wrap_save w_onebuf_opt.wo_wrap_save #define w_p_wrap_save w_onebuf_opt.wo_wrap_save
char *wo_cocu; // 'concealcursor' char *wo_cocu; // 'concealcursor'
#define w_p_cocu w_onebuf_opt.wo_cocu #define w_p_cocu w_onebuf_opt.wo_cocu
long wo_cole; // 'conceallevel' OptInt wo_cole; // 'conceallevel'
#define w_p_cole w_onebuf_opt.wo_cole #define w_p_cole w_onebuf_opt.wo_cole
int wo_crb; int wo_crb;
#define w_p_crb w_onebuf_opt.wo_crb // 'cursorbind' #define w_p_crb w_onebuf_opt.wo_crb // 'cursorbind'
@ -210,9 +210,9 @@ typedef struct {
#define w_p_crb_save w_onebuf_opt.wo_crb_save #define w_p_crb_save w_onebuf_opt.wo_crb_save
char *wo_scl; char *wo_scl;
#define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn' #define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn'
long wo_siso; OptInt wo_siso;
#define w_p_siso w_onebuf_opt.wo_siso // 'sidescrolloff' local value #define w_p_siso w_onebuf_opt.wo_siso // 'sidescrolloff' local value
long wo_so; OptInt wo_so;
#define w_p_so w_onebuf_opt.wo_so // 'scrolloff' local value #define w_p_so w_onebuf_opt.wo_so // 'scrolloff' local value
char *wo_winhl; char *wo_winhl;
#define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight' #define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight'
@ -220,7 +220,7 @@ typedef struct {
#define w_p_lcs w_onebuf_opt.wo_lcs // 'listchars' #define w_p_lcs w_onebuf_opt.wo_lcs // 'listchars'
char *wo_fcs; char *wo_fcs;
#define w_p_fcs w_onebuf_opt.wo_fcs // 'fillchars' #define w_p_fcs w_onebuf_opt.wo_fcs // 'fillchars'
long wo_winbl; OptInt wo_winbl;
#define w_p_winbl w_onebuf_opt.wo_winbl // 'winblend' #define w_p_winbl w_onebuf_opt.wo_winbl // 'winblend'
LastSet wo_script_ctx[WV_COUNT]; // SCTXs for window-local options LastSet wo_script_ctx[WV_COUNT]; // SCTXs for window-local options
@ -504,8 +504,8 @@ struct file_buffer {
bool b_scanned; // ^N/^P have scanned this buffer bool b_scanned; // ^N/^P have scanned this buffer
// flags for use of ":lmap" and IM control // flags for use of ":lmap" and IM control
long b_p_iminsert; // input mode for insert OptInt b_p_iminsert; // input mode for insert
long b_p_imsearch; // input mode for search OptInt b_p_imsearch; // input mode for search
#define B_IMODE_USE_INSERT (-1) // Use b_p_iminsert value for search #define B_IMODE_USE_INSERT (-1) // Use b_p_iminsert value for search
#define B_IMODE_NONE 0 // Input via none #define B_IMODE_NONE 0 // Input via none
#define B_IMODE_LMAP 1 // Input via langmap #define B_IMODE_LMAP 1 // Input via langmap
@ -534,7 +534,7 @@ struct file_buffer {
char *b_p_bt; ///< 'buftype' char *b_p_bt; ///< 'buftype'
int b_has_qf_entry; ///< quickfix exists for buffer int b_has_qf_entry; ///< quickfix exists for buffer
int b_p_bl; ///< 'buflisted' int b_p_bl; ///< 'buflisted'
long b_p_channel; ///< 'channel' OptInt b_p_channel; ///< 'channel'
int b_p_cin; ///< 'cindent' int b_p_cin; ///< 'cindent'
char *b_p_cino; ///< 'cinoptions' char *b_p_cino; ///< 'cinoptions'
char *b_p_cink; ///< 'cinkeys' char *b_p_cink; ///< 'cinkeys'
@ -587,27 +587,27 @@ struct file_buffer {
int b_p_pi; ///< 'preserveindent' int b_p_pi; ///< 'preserveindent'
char *b_p_qe; ///< 'quoteescape' char *b_p_qe; ///< 'quoteescape'
int b_p_ro; ///< 'readonly' int b_p_ro; ///< 'readonly'
long b_p_sw; ///< 'shiftwidth' OptInt b_p_sw; ///< 'shiftwidth'
long b_p_scbk; ///< 'scrollback' OptInt b_p_scbk; ///< 'scrollback'
int b_p_si; ///< 'smartindent' int b_p_si; ///< 'smartindent'
long b_p_sts; ///< 'softtabstop' OptInt b_p_sts; ///< 'softtabstop'
long b_p_sts_nopaste; ///< b_p_sts saved for paste mode OptInt b_p_sts_nopaste; ///< b_p_sts saved for paste mode
char *b_p_sua; ///< 'suffixesadd' char *b_p_sua; ///< 'suffixesadd'
int b_p_swf; ///< 'swapfile' int b_p_swf; ///< 'swapfile'
long b_p_smc; ///< 'synmaxcol' OptInt b_p_smc; ///< 'synmaxcol'
char *b_p_syn; ///< 'syntax' char *b_p_syn; ///< 'syntax'
long b_p_ts; ///< 'tabstop' OptInt b_p_ts; ///< 'tabstop'
long b_p_tw; ///< 'textwidth' OptInt b_p_tw; ///< 'textwidth'
long b_p_tw_nobin; ///< b_p_tw saved for binary mode OptInt b_p_tw_nobin; ///< b_p_tw saved for binary mode
long b_p_tw_nopaste; ///< b_p_tw saved for paste mode OptInt b_p_tw_nopaste; ///< b_p_tw saved for paste mode
long b_p_wm; ///< 'wrapmargin' OptInt b_p_wm; ///< 'wrapmargin'
long b_p_wm_nobin; ///< b_p_wm saved for binary mode OptInt b_p_wm_nobin; ///< b_p_wm saved for binary mode
long b_p_wm_nopaste; ///< b_p_wm saved for paste mode OptInt b_p_wm_nopaste; ///< b_p_wm saved for paste mode
char *b_p_vsts; ///< 'varsofttabstop' char *b_p_vsts; ///< 'varsofttabstop'
long *b_p_vsts_array; ///< 'varsofttabstop' in internal format colnr_T *b_p_vsts_array; ///< 'varsofttabstop' in internal format
char *b_p_vsts_nopaste; ///< b_p_vsts saved for paste mode char *b_p_vsts_nopaste; ///< b_p_vsts saved for paste mode
char *b_p_vts; ///< 'vartabstop' char *b_p_vts; ///< 'vartabstop'
long *b_p_vts_array; ///< 'vartabstop' in internal format colnr_T *b_p_vts_array; ///< 'vartabstop' in internal format
char *b_p_keymap; ///< 'keymap' char *b_p_keymap; ///< 'keymap'
// local values for options which are normally global // local values for options which are normally global
@ -624,7 +624,7 @@ struct file_buffer {
char *b_p_tsr; ///< 'thesaurus' local value char *b_p_tsr; ///< 'thesaurus' local value
char *b_p_tsrfu; ///< 'thesaurusfunc' local value char *b_p_tsrfu; ///< 'thesaurusfunc' local value
Callback b_tsrfu_cb; ///< 'thesaurusfunc' callback Callback b_tsrfu_cb; ///< 'thesaurusfunc' callback
long b_p_ul; ///< 'undolevels' local value OptInt b_p_ul; ///< 'undolevels' local value
int b_p_udf; ///< 'undofile' int b_p_udf; ///< 'undofile'
char *b_p_lw; ///< 'lispwords' local value char *b_p_lw; ///< 'lispwords' local value
@ -789,16 +789,16 @@ struct diffblock_S {
typedef struct tabpage_S tabpage_T; typedef struct tabpage_S tabpage_T;
struct tabpage_S { struct tabpage_S {
handle_T handle; handle_T handle;
tabpage_T *tp_next; ///< next tabpage or NULL tabpage_T *tp_next; ///< next tabpage or NULL
frame_T *tp_topframe; ///< topframe for the windows frame_T *tp_topframe; ///< topframe for the windows
win_T *tp_curwin; ///< current window in this Tab page win_T *tp_curwin; ///< current window in this Tab page
win_T *tp_prevwin; ///< previous window in this Tab page win_T *tp_prevwin; ///< previous window in this Tab page
win_T *tp_firstwin; ///< first window in this Tab page win_T *tp_firstwin; ///< first window in this Tab page
win_T *tp_lastwin; ///< last window in this Tab page win_T *tp_lastwin; ///< last window in this Tab page
long tp_old_Rows_avail; ///< ROWS_AVAIL when Tab page was left int64_t tp_old_Rows_avail; ///< ROWS_AVAIL when Tab page was left
long tp_old_Columns; ///< Columns when Tab page was left, -1 when int64_t tp_old_Columns; ///< Columns when Tab page was left, -1 when
///< calling win_new_screen_cols() postponed ///< calling win_new_screen_cols() postponed
long tp_ch_used; ///< value of 'cmdheight' when frame size was set OptInt tp_ch_used; ///< value of 'cmdheight' when frame size was set
diff_T *tp_first_diff; diff_T *tp_first_diff;
buf_T *(tp_diffbuf[DB_COUNT]); buf_T *(tp_diffbuf[DB_COUNT]);

View File

@ -788,7 +788,7 @@ void channel_terminal_open(buf_T *buf, Channel *chan)
topts.write_cb = term_write; topts.write_cb = term_write;
topts.resize_cb = term_resize; topts.resize_cb = term_resize;
topts.close_cb = term_close; topts.close_cb = term_close;
buf->b_p_channel = (long)chan->id; // 'channel' option buf->b_p_channel = (OptInt)chan->id; // 'channel' option
Terminal *term = terminal_open(buf, topts); Terminal *term = terminal_open(buf, topts);
chan->term = term; chan->term = term;
channel_incref(chan); channel_incref(chan);

View File

@ -4636,8 +4636,6 @@ static int ins_ctrl_ey(int tc)
} else { } else {
c = ins_copychar(curwin->w_cursor.lnum + (c == Ctrl_Y ? -1 : 1)); c = ins_copychar(curwin->w_cursor.lnum + (c == Ctrl_Y ? -1 : 1));
if (c != NUL) { if (c != NUL) {
long tw_save;
// The character must be taken literally, insert like it // The character must be taken literally, insert like it
// was typed after a CTRL-V, and pretend 'textwidth' // was typed after a CTRL-V, and pretend 'textwidth'
// wasn't set. Digits, 'o' and 'x' are special after a // wasn't set. Digits, 'o' and 'x' are special after a
@ -4645,7 +4643,7 @@ static int ins_ctrl_ey(int tc)
if (c < 256 && !isalnum(c)) { if (c < 256 && !isalnum(c)) {
AppendToRedobuff(CTRL_V_STR); AppendToRedobuff(CTRL_V_STR);
} }
tw_save = curbuf->b_p_tw; OptInt tw_save = curbuf->b_p_tw;
curbuf->b_p_tw = -1; curbuf->b_p_tw = -1;
insert_special(c, true, false); insert_special(c, true, false);
curbuf->b_p_tw = tw_save; curbuf->b_p_tw = tw_save;

View File

@ -801,8 +801,8 @@ static char *ex_let_option(char *arg, typval_T *const tv, const bool is_const,
if (op != NULL && *op != '=') { if (op != NULL && *op != '=') {
if (!hidden && is_num) { // number or bool if (!hidden && is_num) { // number or bool
Integer cur_n = curval.type == kOptValTypeNumber ? curval.data.number : curval.data.boolean; OptInt cur_n = curval.type == kOptValTypeNumber ? curval.data.number : curval.data.boolean;
Integer new_n = newval.type == kOptValTypeNumber ? newval.data.number : newval.data.boolean; OptInt new_n = newval.type == kOptValTypeNumber ? newval.data.number : newval.data.boolean;
switch (*op) { switch (*op) {
case '+': case '+':
@ -1873,7 +1873,7 @@ static OptVal tv_to_optval(typval_T *tv, const char *option, uint32_t flags, boo
semsg(_("E521: Number required: &%s = '%s'"), option, tv->vval.v_string); semsg(_("E521: Number required: &%s = '%s'"), option, tv->vval.v_string);
} }
} }
value = (flags & P_NUM) ? NUMBER_OPTVAL(n) value = (flags & P_NUM) ? NUMBER_OPTVAL((OptInt)n)
: BOOLEAN_OPTVAL(n == 0 ? kFalse : (n >= 1 ? kTrue : kNone)); : BOOLEAN_OPTVAL(n == 0 ? kFalse : (n >= 1 ? kTrue : kNone));
} else if ((flags & P_STRING) || is_tty_option(option)) { } else if ((flags & P_STRING) || is_tty_option(option)) {
// Avoid setting string option to a boolean or a special value. // Avoid setting string option to a boolean or a special value.

View File

@ -2148,7 +2148,6 @@ int do_ecmd(int fnum, char *ffname, char *sfname, exarg_T *eap, linenr_T newlnum
bufref_T old_curbuf; bufref_T old_curbuf;
char *free_fname = NULL; char *free_fname = NULL;
int retval = FAIL; int retval = FAIL;
long n;
pos_T orig_pos; pos_T orig_pos;
linenr_T topline = 0; linenr_T topline = 0;
int newcol = -1; int newcol = -1;
@ -2158,7 +2157,7 @@ int do_ecmd(int fnum, char *ffname, char *sfname, exarg_T *eap, linenr_T newlnum
bool did_get_winopts = false; bool did_get_winopts = false;
int readfile_flags = 0; int readfile_flags = 0;
bool did_inc_redrawing_disabled = false; bool did_inc_redrawing_disabled = false;
long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; OptInt *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so;
if (eap != NULL) { if (eap != NULL) {
command = eap->do_ecmd_cmd; command = eap->do_ecmd_cmd;
@ -2719,7 +2718,7 @@ int do_ecmd(int fnum, char *ffname, char *sfname, exarg_T *eap, linenr_T newlnum
RedrawingDisabled--; RedrawingDisabled--;
did_inc_redrawing_disabled = false; did_inc_redrawing_disabled = false;
if (!skip_redraw) { if (!skip_redraw) {
n = *so_ptr; OptInt n = *so_ptr;
if (topline == 0 && command == NULL) { if (topline == 0 && command == NULL) {
*so_ptr = 999; // force cursor to be vertically centered in the window *so_ptr = 999; // force cursor to be vertically centered in the window
} }

View File

@ -290,7 +290,7 @@ typedef struct {
// values for undo_cmdmod() // values for undo_cmdmod()
char *cmod_save_ei; ///< saved value of 'eventignore' char *cmod_save_ei; ///< saved value of 'eventignore'
int cmod_did_sandbox; ///< set when "sandbox" was incremented int cmod_did_sandbox; ///< set when "sandbox" was incremented
long cmod_verbose_save; ///< if 'verbose' was set: value of p_verbose plus one OptInt cmod_verbose_save; ///< if 'verbose' was set: value of p_verbose plus one
int cmod_save_msg_silent; ///< if non-zero: saved value of msg_silent + 1 int cmod_save_msg_silent; ///< if non-zero: saved value of msg_silent + 1
int cmod_save_msg_scroll; ///< for restoring msg_scroll int cmod_save_msg_scroll; ///< for restoring msg_scroll
int cmod_did_esilent; ///< incremented when emsg_silent is int cmod_did_esilent; ///< incremented when emsg_silent is

View File

@ -127,7 +127,7 @@ typedef struct command_line_state {
int ignore_drag_release; int ignore_drag_release;
int break_ctrl_c; int break_ctrl_c;
expand_T xpc; expand_T xpc;
long *b_im_ptr; OptInt *b_im_ptr;
buf_T *b_im_ptr_buf; ///< buffer where b_im_ptr is valid buf_T *b_im_ptr_buf; ///< buffer where b_im_ptr is valid
} CommandLineState; } CommandLineState;
@ -149,7 +149,7 @@ typedef struct cmdpreview_undo_info {
typedef struct cmdpreview_buf_info { typedef struct cmdpreview_buf_info {
buf_T *buf; buf_T *buf;
long save_b_p_ul; OptInt save_b_p_ul;
int save_b_changed; int save_b_changed;
varnumber_T save_changedtick; varnumber_T save_changedtick;
CpUndoInfo undo_info; CpUndoInfo undo_info;
@ -1560,7 +1560,7 @@ static int command_line_erase_chars(CommandLineState *s)
/// language :lmap mappings and/or Input Method. /// language :lmap mappings and/or Input Method.
static void command_line_toggle_langmap(CommandLineState *s) static void command_line_toggle_langmap(CommandLineState *s)
{ {
long *b_im_ptr = buf_valid(s->b_im_ptr_buf) ? s->b_im_ptr : NULL; OptInt *b_im_ptr = buf_valid(s->b_im_ptr_buf) ? s->b_im_ptr : NULL;
if (map_to_exists_mode("", MODE_LANGMAP, false)) { if (map_to_exists_mode("", MODE_LANGMAP, false)) {
// ":lmap" mappings exists, toggle use of mappings. // ":lmap" mappings exists, toggle use of mappings.
State ^= MODE_LANGMAP; State ^= MODE_LANGMAP;

View File

@ -2695,9 +2695,9 @@ static int vgetorpeek(bool advance)
// blocking wait // blocking wait
wait_time = -1L; wait_time = -1L;
} else if (keylen == KEYLEN_PART_KEY && p_ttm >= 0) { } else if (keylen == KEYLEN_PART_KEY && p_ttm >= 0) {
wait_time = p_ttm; wait_time = (long)p_ttm;
} else { } else {
wait_time = p_tm; wait_time = (long)p_tm;
} }
} }

View File

@ -51,7 +51,7 @@
/// "array" will be set, caller must free it if needed. /// "array" will be set, caller must free it if needed.
/// ///
/// @return false for an error. /// @return false for an error.
bool tabstop_set(char *var, long **array) bool tabstop_set(char *var, colnr_T **array)
{ {
long valcount = 1; long valcount = 1;
int t; int t;
@ -87,8 +87,8 @@ bool tabstop_set(char *var, long **array)
return false; return false;
} }
*array = (long *)xmalloc((unsigned)(valcount + 1) * sizeof(long)); *array = (colnr_T *)xmalloc((unsigned)(valcount + 1) * sizeof(long));
(*array)[0] = valcount; (*array)[0] = (colnr_T)valcount;
t = 1; t = 1;
for (cp = var; *cp != NUL;) { for (cp = var; *cp != NUL;) {
@ -115,9 +115,9 @@ bool tabstop_set(char *var, long **array)
/// Calculate the number of screen spaces a tab will occupy. /// Calculate the number of screen spaces a tab will occupy.
/// If "vts" is set then the tab widths are taken from that array, /// If "vts" is set then the tab widths are taken from that array,
/// otherwise the value of ts is used. /// otherwise the value of ts is used.
int tabstop_padding(colnr_T col, long ts_arg, const long *vts) int tabstop_padding(colnr_T col, OptInt ts_arg, const colnr_T *vts)
{ {
long ts = ts_arg == 0 ? 8 : ts_arg; OptInt ts = ts_arg == 0 ? 8 : ts_arg;
colnr_T tabcol = 0; colnr_T tabcol = 0;
int t; int t;
long padding = 0; long padding = 0;
@ -129,7 +129,7 @@ int tabstop_padding(colnr_T col, long ts_arg, const long *vts)
const long tabcount = vts[0]; const long tabcount = vts[0];
for (t = 1; t <= tabcount; t++) { for (t = 1; t <= tabcount; t++) {
tabcol += (colnr_T)vts[t]; tabcol += vts[t];
if (tabcol > col) { if (tabcol > col) {
padding = tabcol - col; padding = tabcol - col;
break; break;
@ -143,7 +143,7 @@ int tabstop_padding(colnr_T col, long ts_arg, const long *vts)
} }
/// Find the size of the tab that covers a particular column. /// Find the size of the tab that covers a particular column.
int tabstop_at(colnr_T col, long ts, const long *vts) int tabstop_at(colnr_T col, OptInt ts, const colnr_T *vts)
{ {
colnr_T tabcol = 0; colnr_T tabcol = 0;
int t; int t;
@ -155,7 +155,7 @@ int tabstop_at(colnr_T col, long ts, const long *vts)
const long tabcount = vts[0]; const long tabcount = vts[0];
for (t = 1; t <= tabcount; t++) { for (t = 1; t <= tabcount; t++) {
tabcol += (colnr_T)vts[t]; tabcol += vts[t];
if (tabcol > col) { if (tabcol > col) {
tab_size = vts[t]; tab_size = vts[t];
break; break;
@ -169,7 +169,7 @@ int tabstop_at(colnr_T col, long ts, const long *vts)
} }
/// Find the column on which a tab starts. /// Find the column on which a tab starts.
colnr_T tabstop_start(colnr_T col, long ts, long *vts) colnr_T tabstop_start(colnr_T col, long ts, colnr_T *vts)
{ {
colnr_T tabcol = 0; colnr_T tabcol = 0;
int t; int t;
@ -180,26 +180,26 @@ colnr_T tabstop_start(colnr_T col, long ts, long *vts)
const long tabcount = vts[0]; const long tabcount = vts[0];
for (t = 1; t <= tabcount; t++) { for (t = 1; t <= tabcount; t++) {
tabcol += (colnr_T)vts[t]; tabcol += vts[t];
if (tabcol > col) { if (tabcol > col) {
return (int)(tabcol - vts[t]); return (tabcol - vts[t]);
} }
} }
const int excess = (int)(tabcol % vts[tabcount]); const int excess = (tabcol % vts[tabcount]);
return (int)(excess + ((col - excess) / vts[tabcount]) * vts[tabcount]); return (excess + ((col - excess) / vts[tabcount]) * vts[tabcount]);
} }
/// Find the number of tabs and spaces necessary to get from one column /// Find the number of tabs and spaces necessary to get from one column
/// to another. /// to another.
void tabstop_fromto(colnr_T start_col, colnr_T end_col, long ts_arg, const long *vts, int *ntabs, void tabstop_fromto(colnr_T start_col, colnr_T end_col, long ts_arg, const colnr_T *vts, int *ntabs,
int *nspcs) int *nspcs)
{ {
int spaces = end_col - start_col; int spaces = end_col - start_col;
colnr_T tabcol = 0; colnr_T tabcol = 0;
long padding = 0; long padding = 0;
int t; int t;
long ts = ts_arg == 0 ? curbuf->b_p_ts : ts_arg; long ts = ts_arg == 0 ? (long)curbuf->b_p_ts : ts_arg;
assert(ts != 0); // suppress clang "Division by zero" assert(ts != 0); // suppress clang "Division by zero"
if (vts == NULL || vts[0] == 0) { if (vts == NULL || vts[0] == 0) {
@ -221,7 +221,7 @@ void tabstop_fromto(colnr_T start_col, colnr_T end_col, long ts_arg, const long
// Find the padding needed to reach the next tabstop. // Find the padding needed to reach the next tabstop.
const long tabcount = vts[0]; const long tabcount = vts[0];
for (t = 1; t <= tabcount; t++) { for (t = 1; t <= tabcount; t++) {
tabcol += (colnr_T)vts[t]; tabcol += vts[t];
if (tabcol > start_col) { if (tabcol > start_col) {
padding = tabcol - start_col; padding = tabcol - start_col;
break; break;
@ -257,7 +257,7 @@ void tabstop_fromto(colnr_T start_col, colnr_T end_col, long ts_arg, const long
} }
/// See if two tabstop arrays contain the same values. /// See if two tabstop arrays contain the same values.
bool tabstop_eq(const long *ts1, const long *ts2) bool tabstop_eq(const colnr_T *ts1, const colnr_T *ts2)
{ {
int t; int t;
@ -299,13 +299,13 @@ int *tabstop_copy(const long *oldts)
} }
/// Return a count of the number of tabstops. /// Return a count of the number of tabstops.
int tabstop_count(long *ts) int tabstop_count(colnr_T *ts)
{ {
return ts != NULL ? (int)ts[0] : 0; return ts != NULL ? (int)ts[0] : 0;
} }
/// Return the first tabstop, or 8 if there are no tabstops defined. /// Return the first tabstop, or 8 if there are no tabstops defined.
int tabstop_first(long *ts) int tabstop_first(colnr_T *ts)
{ {
return ts != NULL ? (int)ts[1] : 8; return ts != NULL ? (int)ts[1] : 8;
} }
@ -343,7 +343,7 @@ long get_sw_value_indent(buf_T *buf)
/// Idem, using virtual column "col". /// Idem, using virtual column "col".
long get_sw_value_col(buf_T *buf, colnr_T col) long get_sw_value_col(buf_T *buf, colnr_T col)
{ {
return buf->b_p_sw ? buf->b_p_sw return buf->b_p_sw ? (long)buf->b_p_sw
: tabstop_at(col, buf->b_p_ts, buf->b_p_vts_array); : tabstop_at(col, buf->b_p_ts, buf->b_p_vts_array);
} }
@ -351,9 +351,8 @@ long get_sw_value_col(buf_T *buf, colnr_T col)
/// using the shiftwidth value when 'softtabstop' is negative. /// using the shiftwidth value when 'softtabstop' is negative.
int get_sts_value(void) int get_sts_value(void)
{ {
long result = curbuf->b_p_sts < 0 ? get_sw_value(curbuf) : curbuf->b_p_sts; int result = curbuf->b_p_sts < 0 ? get_sw_value(curbuf) : (int)curbuf->b_p_sts;
assert(result >= 0 && result <= INT_MAX); return result;
return (int)result;
} }
// Count the size (in window cells) of the indent in the current line. // Count the size (in window cells) of the indent in the current line.
@ -413,7 +412,7 @@ int get_indent_str(const char *ptr, int ts, bool list)
/// Count the size (in window cells) of the indent in line "ptr", using /// Count the size (in window cells) of the indent in line "ptr", using
/// variable tabstops. /// variable tabstops.
/// if "list" is true, count only screen size for tabs. /// if "list" is true, count only screen size for tabs.
int get_indent_str_vtab(const char *ptr, long ts, long *vts, bool list) int get_indent_str_vtab(const char *ptr, OptInt ts, colnr_T *vts, bool list)
{ {
int count = 0; int count = 0;
@ -800,11 +799,11 @@ int get_breakindent_win(win_T *wp, char *line)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
static int prev_indent = 0; // cached indent value static int prev_indent = 0; // cached indent value
static long prev_ts = 0L; // cached tabstop value static OptInt prev_ts = 0L; // cached tabstop value
static int prev_fnum = 0; // cached buffer number static int prev_fnum = 0; // cached buffer number
static char *prev_line = NULL; // cached copy of "line" static char *prev_line = NULL; // cached copy of "line"
static varnumber_T prev_tick = 0; // changedtick of cached value static varnumber_T prev_tick = 0; // changedtick of cached value
static long *prev_vts = NULL; // cached vartabs values static colnr_T *prev_vts = NULL; // cached vartabs values
static int prev_list = 0; // cached list value static int prev_list = 0; // cached list value
static int prev_listopt = 0; // cached w_p_briopt_list value static int prev_listopt = 0; // cached w_p_briopt_list value
static char *prev_flp = NULL; // cached formatlistpat value static char *prev_flp = NULL; // cached formatlistpat value
@ -945,7 +944,7 @@ void ex_retab(exarg_T *eap)
long start_vcol = 0; // For start of white-space string long start_vcol = 0; // For start of white-space string
long old_len; long old_len;
char *new_line = (char *)1; // init to non-NULL char *new_line = (char *)1; // init to non-NULL
long *new_vts_array = NULL; colnr_T *new_vts_array = NULL;
char *new_ts_str; // string value of tab argument char *new_ts_str; // string value of tab argument
int save_list; int save_list;
@ -1000,7 +999,7 @@ void ex_retab(exarg_T *eap)
int t, s; int t, s;
tabstop_fromto((colnr_T)start_vcol, (colnr_T)vcol, tabstop_fromto((colnr_T)start_vcol, (colnr_T)vcol,
curbuf->b_p_ts, new_vts_array, &t, &s); (long)curbuf->b_p_ts, new_vts_array, &t, &s);
num_tabs = t; num_tabs = t;
num_spaces = s; num_spaces = s;
} }
@ -1091,7 +1090,7 @@ void ex_retab(exarg_T *eap)
if (new_ts_str != NULL) { // set the new tabstop if (new_ts_str != NULL) { // set the new tabstop
// If 'vartabstop' is in use or if the value given to retab has more // If 'vartabstop' is in use or if the value given to retab has more
// than one tabstop then update 'vartabstop'. // than one tabstop then update 'vartabstop'.
long *old_vts_ary = curbuf->b_p_vts_array; colnr_T *old_vts_ary = curbuf->b_p_vts_array;
if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_vts_array) > 1) { if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_vts_array) > 1) {
set_string_option_direct("vts", -1, new_ts_str, OPT_FREE | OPT_LOCAL, 0); set_string_option_direct("vts", -1, new_ts_str, OPT_FREE | OPT_LOCAL, 0);

View File

@ -367,7 +367,7 @@ int main(int argc, char **argv)
} }
assert(p_ch >= 0 && Rows >= p_ch && Rows - p_ch <= INT_MAX); assert(p_ch >= 0 && Rows >= p_ch && Rows - p_ch <= INT_MAX);
cmdline_row = (int)(Rows - p_ch); cmdline_row = Rows - (int)p_ch;
msg_row = cmdline_row; msg_row = cmdline_row;
default_grid_alloc(); // allocate screen buffers default_grid_alloc(); // allocate screen buffers
set_init_2(headless_mode); set_init_2(headless_mode);
@ -1265,7 +1265,7 @@ static void command_line_scan(mparm_T *parmp)
// "-w {scriptout}" write to script // "-w {scriptout}" write to script
if (ascii_isdigit((argv[0])[argv_idx])) { if (ascii_isdigit((argv[0])[argv_idx])) {
n = get_number_arg(argv[0], &argv_idx, 10); n = get_number_arg(argv[0], &argv_idx, 10);
set_option_value_give_err("window", NUMBER_OPTVAL(n), 0); set_option_value_give_err("window", NUMBER_OPTVAL((OptInt)n), 0);
break; break;
} }
want_argument = true; want_argument = true;
@ -1407,7 +1407,7 @@ scripterror:
if (ascii_isdigit(*(argv[0]))) { if (ascii_isdigit(*(argv[0]))) {
argv_idx = 0; argv_idx = 0;
n = get_number_arg(argv[0], &argv_idx, 10); n = get_number_arg(argv[0], &argv_idx, 10);
set_option_value_give_err("window", NUMBER_OPTVAL(n), 0); set_option_value_give_err("window", NUMBER_OPTVAL((OptInt)n), 0);
argv_idx = -1; argv_idx = -1;
break; break;
} }

View File

@ -213,8 +213,8 @@ static void reset_skipcol(win_T *wp)
void update_topline(win_T *wp) void update_topline(win_T *wp)
{ {
bool check_botline = false; bool check_botline = false;
long *so_ptr = wp->w_p_so >= 0 ? &wp->w_p_so : &p_so; OptInt *so_ptr = wp->w_p_so >= 0 ? &wp->w_p_so : &p_so;
long save_so = *so_ptr; OptInt save_so = *so_ptr;
// Cursor is updated instead when this is true for 'splitkeep'. // Cursor is updated instead when this is true for 'splitkeep'.
if (skip_update_topline) { if (skip_update_topline) {
@ -288,7 +288,7 @@ void update_topline(win_T *wp)
if (halfheight < 2) { if (halfheight < 2) {
halfheight = 2; halfheight = 2;
} }
long n; int64_t n;
if (hasAnyFolding(wp)) { if (hasAnyFolding(wp)) {
// Count the number of logical lines between the cursor and // Count the number of logical lines between the cursor and
// topline + p_so (approximation of how much will be // topline + p_so (approximation of how much will be
@ -371,7 +371,7 @@ void update_topline(win_T *wp)
} }
} }
if (check_botline) { if (check_botline) {
long line_count = 0; int line_count = 0;
if (hasAnyFolding(wp)) { if (hasAnyFolding(wp)) {
// Count the number of logical lines between the cursor and // Count the number of logical lines between the cursor and
// botline - p_so (approximation of how much will be // botline - p_so (approximation of how much will be
@ -386,7 +386,7 @@ void update_topline(win_T *wp)
(void)hasFolding(lnum, &lnum, NULL); (void)hasFolding(lnum, &lnum, NULL);
} }
} else { } else {
line_count = wp->w_cursor.lnum - wp->w_botline + 1 + *so_ptr; line_count = wp->w_cursor.lnum - wp->w_botline + 1 + (int)(*so_ptr);
} }
if (line_count <= wp->w_height_inner + 1) { if (line_count <= wp->w_height_inner + 1) {
scroll_cursor_bot(scrolljump_value(), false); scroll_cursor_bot(scrolljump_value(), false);
@ -427,9 +427,8 @@ void update_topline(win_T *wp)
// When 'scrolljump' is negative use it as a percentage of the window height. // When 'scrolljump' is negative use it as a percentage of the window height.
static int scrolljump_value(void) static int scrolljump_value(void)
{ {
long result = p_sj >= 0 ? p_sj : (curwin->w_height_inner * -p_sj) / 100; int result = p_sj >= 0 ? (int)p_sj : (curwin->w_height_inner * (int)(-p_sj)) / 100;
assert(result <= INT_MAX); return result;
return (int)result;
} }
// Return true when there are not 'scrolloff' lines above the cursor for the // Return true when there are not 'scrolloff' lines above the cursor for the

View File

@ -803,13 +803,13 @@ static void normal_get_additional_char(NormalState *s)
&& s->ca.cmdchar == 'g') { && s->ca.cmdchar == 'g') {
s->ca.oap->op_type = get_op_type(*cp, NUL); s->ca.oap->op_type = get_op_type(*cp, NUL);
} else if (*cp == Ctrl_BSL) { } else if (*cp == Ctrl_BSL) {
long towait = (p_ttm >= 0 ? p_ttm : p_tm); int towait = (p_ttm >= 0 ? (int)p_ttm : (int)p_tm);
// There is a busy wait here when typing "f<C-\>" and then // There is a busy wait here when typing "f<C-\>" and then
// something different from CTRL-N. Can't be avoided. // something different from CTRL-N. Can't be avoided.
while ((s->c = vpeekc()) <= 0 && towait > 0L) { while ((s->c = vpeekc()) <= 0 && towait > 0) {
do_sleep(towait > 50L ? 50L : towait); do_sleep(towait > 50 ? 50 : towait);
towait -= 50L; towait -= 50;
} }
if (s->c > 0) { if (s->c > 0) {
s->c = plain_vgetc(); s->c = plain_vgetc();
@ -2785,7 +2785,7 @@ static void nv_zet(cmdarg_T *cap)
{ {
colnr_T col; colnr_T col;
int nchar = cap->nchar; int nchar = cap->nchar;
long old_fdl = curwin->w_p_fdl; long old_fdl = (long)curwin->w_p_fdl;
int old_fen = curwin->w_p_fen; int old_fen = curwin->w_p_fen;
int siso = get_sidescrolloff_value(curwin); int siso = get_sidescrolloff_value(curwin);

View File

@ -3182,7 +3182,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
if (cur_ve_flags == VE_ALL && y_type == kMTCharWise) { if (cur_ve_flags == VE_ALL && y_type == kMTCharWise) {
if (gchar_cursor() == TAB) { if (gchar_cursor() == TAB) {
int viscol = getviscol(); int viscol = getviscol();
long ts = curbuf->b_p_ts; OptInt ts = curbuf->b_p_ts;
// Don't need to insert spaces when "p" on the last position of a // Don't need to insert spaces when "p" on the last position of a
// tab or "P" on the first position. // tab or "P" on the first position.
if (dir == FORWARD if (dir == FORWARD

View File

@ -125,15 +125,15 @@ static char *p_ttytype = NULL;
// Saved values for when 'bin' is set. // Saved values for when 'bin' is set.
static int p_et_nobin; static int p_et_nobin;
static int p_ml_nobin; static int p_ml_nobin;
static long p_tw_nobin; static OptInt p_tw_nobin;
static long p_wm_nobin; static OptInt p_wm_nobin;
// Saved values for when 'paste' is set. // Saved values for when 'paste' is set.
static int p_ai_nopaste; static int p_ai_nopaste;
static int p_et_nopaste; static int p_et_nopaste;
static long p_sts_nopaste; static OptInt p_sts_nopaste;
static long p_tw_nopaste; static OptInt p_tw_nopaste;
static long p_wm_nopaste; static OptInt p_wm_nopaste;
static char *p_vsts_nopaste; static char *p_vsts_nopaste;
#define OPTION_COUNT ARRAY_SIZE(options) #define OPTION_COUNT ARRAY_SIZE(options)
@ -172,7 +172,7 @@ void set_init_tablocal(void)
{ {
// susy baka: cmdheight calls itself OPT_GLOBAL but is really tablocal! // susy baka: cmdheight calls itself OPT_GLOBAL but is really tablocal!
int ch_idx = findoption("cmdheight"); int ch_idx = findoption("cmdheight");
p_ch = (long)options[ch_idx].def_val; p_ch = (OptInt)(intptr_t)options[ch_idx].def_val;
} }
/// Initialize the 'shell' option to a default value. /// Initialize the 'shell' option to a default value.
@ -449,19 +449,18 @@ static void set_option_default(const int opt_idx, int opt_flags)
if (opt->indir == PV_SCROLL) { if (opt->indir == PV_SCROLL) {
win_comp_scroll(curwin); win_comp_scroll(curwin);
} else { } else {
long def_val = (long)opt->def_val; OptInt def_val = (OptInt)(intptr_t)opt->def_val;
if ((long *)varp == &curwin->w_p_so if ((OptInt *)varp == &curwin->w_p_so
|| (long *)varp == &curwin->w_p_siso) { || (OptInt *)varp == &curwin->w_p_siso) {
// 'scrolloff' and 'sidescrolloff' local values have a // 'scrolloff' and 'sidescrolloff' local values have a
// different default value than the global default. // different default value than the global default.
*(long *)varp = -1; *(OptInt *)varp = -1;
} else { } else {
*(long *)varp = def_val; *(OptInt *)varp = def_val;
} }
// May also set global value for local option. // May also set global value for local option.
if (both) { if (both) {
*(long *)get_varp_scope(opt, OPT_GLOBAL) = *(OptInt *)get_varp_scope(opt, OPT_GLOBAL) = def_val;
def_val;
} }
} }
} else { // P_BOOL } else { // P_BOOL
@ -802,25 +801,25 @@ static void do_set_num(int opt_idx, int opt_flags, char **argp, int nextchar, co
if (nextchar == '&') { if (nextchar == '&') {
value = (long)(intptr_t)options[opt_idx].def_val; value = (long)(intptr_t)options[opt_idx].def_val;
} else if (nextchar == '<') { } else if (nextchar == '<') {
if ((long *)varp == &curbuf->b_p_ul && opt_flags == OPT_LOCAL) { if ((OptInt *)varp == &curbuf->b_p_ul && opt_flags == OPT_LOCAL) {
// for 'undolevels' NO_LOCAL_UNDOLEVEL means using the global value // for 'undolevels' NO_LOCAL_UNDOLEVEL means using the global value
value = NO_LOCAL_UNDOLEVEL; value = NO_LOCAL_UNDOLEVEL;
} else if (opt_flags == OPT_LOCAL } else if (opt_flags == OPT_LOCAL
&& ((long *)varp == &curwin->w_p_siso && ((OptInt *)varp == &curwin->w_p_siso
|| (long *)varp == &curwin->w_p_so)) { || (OptInt *)varp == &curwin->w_p_so)) {
// for 'scrolloff'/'sidescrolloff' -1 means using the global value // for 'scrolloff'/'sidescrolloff' -1 means using the global value
value = -1; value = -1;
} else { } else {
value = *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL); value = *(OptInt *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL);
} }
} else if (((long *)varp == &p_wc } else if (((OptInt *)varp == &p_wc
|| (long *)varp == &p_wcm) || (OptInt *)varp == &p_wcm)
&& (*arg == '<' && (*arg == '<'
|| *arg == '^' || *arg == '^'
|| (*arg != NUL && (!arg[1] || ascii_iswhite(arg[1])) || (*arg != NUL && (!arg[1] || ascii_iswhite(arg[1]))
&& !ascii_isdigit(*arg)))) { && !ascii_isdigit(*arg)))) {
value = string_to_key(arg); value = string_to_key(arg);
if (value == 0 && (long *)varp != &p_wcm) { if (value == 0 && (OptInt *)varp != &p_wcm) {
*errmsg = e_invarg; *errmsg = e_invarg;
return; return;
} }
@ -838,13 +837,13 @@ static void do_set_num(int opt_idx, int opt_flags, char **argp, int nextchar, co
} }
if (op == OP_ADDING) { if (op == OP_ADDING) {
value = *(long *)varp + value; value = *(OptInt *)varp + value;
} }
if (op == OP_PREPENDING) { if (op == OP_PREPENDING) {
value = *(long *)varp * value; value = *(OptInt *)varp * value;
} }
if (op == OP_REMOVING) { if (op == OP_REMOVING) {
value = *(long *)varp - value; value = *(OptInt *)varp - value;
} }
*errmsg = set_num_option(opt_idx, (void *)varp, (long)value, *errmsg = set_num_option(opt_idx, (void *)varp, (long)value,
errbuf, errbuflen, opt_flags); errbuf, errbuflen, opt_flags);
@ -1979,7 +1978,7 @@ void set_option_sctx_idx(int opt_idx, int opt_flags, sctx_T script_ctx)
} }
/// Apply the OptionSet autocommand. /// Apply the OptionSet autocommand.
static void apply_optionset_autocmd(int opt_idx, long opt_flags, long oldval, long oldval_g, static void apply_optionset_autocmd(int opt_idx, long opt_flags, OptInt oldval, OptInt oldval_g,
long newval, const char *errmsg) long newval, const char *errmsg)
{ {
// Don't do this while starting up, failure or recursively. // Don't do this while starting up, failure or recursively.
@ -1989,8 +1988,8 @@ static void apply_optionset_autocmd(int opt_idx, long opt_flags, long oldval, lo
char buf_old[12], buf_old_global[12], buf_new[12], buf_type[12]; char buf_old[12], buf_old_global[12], buf_new[12], buf_type[12];
vim_snprintf(buf_old, sizeof(buf_old), "%ld", oldval); vim_snprintf(buf_old, sizeof(buf_old), "%" PRId64, oldval);
vim_snprintf(buf_old_global, sizeof(buf_old_global), "%ld", oldval_g); vim_snprintf(buf_old_global, sizeof(buf_old_global), "%" PRId64, oldval_g);
vim_snprintf(buf_new, sizeof(buf_new), "%ld", newval); vim_snprintf(buf_new, sizeof(buf_new), "%ld", newval);
vim_snprintf(buf_type, sizeof(buf_type), "%s", vim_snprintf(buf_type, sizeof(buf_type), "%s",
(opt_flags & OPT_LOCAL) ? "local" : "global"); (opt_flags & OPT_LOCAL) ? "local" : "global");
@ -2652,8 +2651,8 @@ static const char *did_set_winwidth(optset_T *args)
/// Process the new 'laststatus' option value. /// Process the new 'laststatus' option value.
static const char *did_set_laststatus(optset_T *args) static const char *did_set_laststatus(optset_T *args)
{ {
long old_value = args->os_oldval.number; OptInt old_value = args->os_oldval.number;
long value = args->os_newval.number; OptInt value = args->os_newval.number;
// When switching to global statusline, decrease topframe height // When switching to global statusline, decrease topframe height
// Also clear the cmdline to remove the ruler if there is one // Also clear the cmdline to remove the ruler if there is one
@ -2724,7 +2723,7 @@ static const char *did_set_shiftwidth_tabstop(optset_T *args)
{ {
buf_T *buf = (buf_T *)args->os_buf; buf_T *buf = (buf_T *)args->os_buf;
win_T *win = (win_T *)args->os_win; win_T *win = (win_T *)args->os_win;
long *pp = (long *)args->os_varp; OptInt *pp = (OptInt *)args->os_varp;
if (foldmethodIsIndent(win)) { if (foldmethodIsIndent(win)) {
foldUpdateAll(win); foldUpdateAll(win);
@ -2762,7 +2761,7 @@ static const char *did_set_window(optset_T *args FUNC_ATTR_UNUSED)
/// Process the new 'titlelen' option value. /// Process the new 'titlelen' option value.
static const char *did_set_titlelen(optset_T *args) static const char *did_set_titlelen(optset_T *args)
{ {
long old_value = args->os_oldval.number; OptInt old_value = args->os_oldval.number;
// if 'titlelen' has changed, redraw the title // if 'titlelen' has changed, redraw the title
if (starting != NO_SCREEN && old_value != p_titlelen) { if (starting != NO_SCREEN && old_value != p_titlelen) {
@ -2775,7 +2774,7 @@ static const char *did_set_titlelen(optset_T *args)
/// Process the new 'cmdheight' option value. /// Process the new 'cmdheight' option value.
static const char *did_set_cmdheight(optset_T *args) static const char *did_set_cmdheight(optset_T *args)
{ {
long old_value = args->os_oldval.number; OptInt old_value = args->os_oldval.number;
if (ui_has(kUIMessages)) { if (ui_has(kUIMessages)) {
p_ch = 0; p_ch = 0;
@ -2799,7 +2798,7 @@ static const char *did_set_cmdheight(optset_T *args)
/// Process the new 'updatecount' option value. /// Process the new 'updatecount' option value.
static const char *did_set_updatecount(optset_T *args) static const char *did_set_updatecount(optset_T *args)
{ {
long old_value = args->os_oldval.number; OptInt old_value = args->os_oldval.number;
// when 'updatecount' changes from zero to non-zero, open swap files // when 'updatecount' changes from zero to non-zero, open swap files
if (p_uc && !old_value) { if (p_uc && !old_value) {
@ -2823,7 +2822,7 @@ static const char *did_set_pumblend(optset_T *args FUNC_ATTR_UNUSED)
} }
/// Process the new global 'undolevels' option value. /// Process the new global 'undolevels' option value.
const char *did_set_global_undolevels(long value, long old_value) const char *did_set_global_undolevels(OptInt value, OptInt old_value)
{ {
// sync undo before 'undolevels' changes // sync undo before 'undolevels' changes
// use the old value, otherwise u_sync() may not work properly // use the old value, otherwise u_sync() may not work properly
@ -2834,7 +2833,7 @@ const char *did_set_global_undolevels(long value, long old_value)
} }
/// Process the new buffer local 'undolevels' option value. /// Process the new buffer local 'undolevels' option value.
const char *did_set_buflocal_undolevels(buf_T *buf, long value, long old_value) const char *did_set_buflocal_undolevels(buf_T *buf, OptInt value, OptInt old_value)
{ {
// use the old value, otherwise u_sync() may not work properly // use the old value, otherwise u_sync() may not work properly
buf->b_p_ul = old_value; buf->b_p_ul = old_value;
@ -2847,8 +2846,8 @@ const char *did_set_buflocal_undolevels(buf_T *buf, long value, long old_value)
static const char *did_set_scrollback(optset_T *args) static const char *did_set_scrollback(optset_T *args)
{ {
buf_T *buf = (buf_T *)args->os_buf; buf_T *buf = (buf_T *)args->os_buf;
long old_value = args->os_oldval.number; OptInt old_value = args->os_oldval.number;
long value = args->os_newval.number; OptInt value = args->os_newval.number;
if (buf->terminal && value < old_value) { if (buf->terminal && value < old_value) {
// Force the scrollback to take immediate effect only when decreasing it. // Force the scrollback to take immediate effect only when decreasing it.
@ -2880,8 +2879,8 @@ static const char *did_set_textwidth(optset_T *args FUNC_ATTR_UNUSED)
static const char *did_set_winblend(optset_T *args) static const char *did_set_winblend(optset_T *args)
{ {
win_T *win = (win_T *)args->os_win; win_T *win = (win_T *)args->os_win;
long old_value = args->os_oldval.number; OptInt old_value = args->os_oldval.number;
long value = args->os_newval.number; OptInt value = args->os_newval.number;
if (value != old_value) { if (value != old_value) {
win->w_p_winbl = MAX(MIN(win->w_p_winbl, 100), 0); win->w_p_winbl = MAX(MIN(win->w_p_winbl, 100), 0);
@ -2896,7 +2895,7 @@ static const char *did_set_winblend(optset_T *args)
static const char *did_set_undolevels(optset_T *args) static const char *did_set_undolevels(optset_T *args)
{ {
buf_T *buf = (buf_T *)args->os_buf; buf_T *buf = (buf_T *)args->os_buf;
long *pp = (long *)args->os_varp; OptInt *pp = (OptInt *)args->os_varp;
if (pp == &p_ul) { // global 'undolevels' if (pp == &p_ul) { // global 'undolevels'
did_set_global_undolevels(args->os_newval.number, args->os_oldval.number); did_set_global_undolevels(args->os_newval.number, args->os_oldval.number);
@ -2908,8 +2907,8 @@ static const char *did_set_undolevels(optset_T *args)
} }
/// Check the bounds of numeric options. /// Check the bounds of numeric options.
static const char *check_num_option_bounds(long *pp, long old_value, long old_Rows, char *errbuf, static const char *check_num_option_bounds(OptInt *pp, OptInt old_value, long old_Rows,
size_t errbuflen, const char *errmsg) char *errbuf, size_t errbuflen, const char *errmsg)
{ {
// Check the (new) bounds for Rows and Columns here. // Check the (new) bounds for Rows and Columns here.
if (p_lines < min_rows() && full_screen) { if (p_lines < min_rows() && full_screen) {
@ -2984,7 +2983,7 @@ static const char *check_num_option_bounds(long *pp, long old_value, long old_Ro
} }
/// Options that need some validation. /// Options that need some validation.
static const char *validate_num_option(const long *pp, long *valuep) static const char *validate_num_option(const OptInt *pp, long *valuep)
{ {
long value = *valuep; long value = *valuep;
@ -3147,10 +3146,10 @@ static const char *validate_num_option(const long *pp, long *valuep)
static const char *set_num_option(int opt_idx, void *varp, long value, char *errbuf, static const char *set_num_option(int opt_idx, void *varp, long value, char *errbuf,
size_t errbuflen, int opt_flags) size_t errbuflen, int opt_flags)
{ {
long old_value = *(long *)varp; OptInt old_value = *(OptInt *)varp;
long old_global_value = 0; // only used when setting a local and global option OptInt old_global_value = 0; // only used when setting a local and global option
long old_Rows = Rows; // remember old Rows long old_Rows = Rows; // remember old Rows
long *pp = (long *)varp; OptInt *pp = (OptInt *)varp;
// Disallow changing some options from secure mode. // Disallow changing some options from secure mode.
if ((secure || sandbox != 0) && (options[opt_idx].flags & P_SECURE)) { if ((secure || sandbox != 0) && (options[opt_idx].flags & P_SECURE)) {
@ -3161,7 +3160,7 @@ static const char *set_num_option(int opt_idx, void *varp, long value, char *err
// a global-only option setting the "local value" in fact sets the global // a global-only option setting the "local value" in fact sets the global
// value (since there is only one value). // value (since there is only one value).
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) { if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) {
old_global_value = *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL); old_global_value = *(OptInt *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL);
} }
const char *errmsg = validate_num_option(pp, &value); const char *errmsg = validate_num_option(pp, &value);
@ -3171,7 +3170,7 @@ static const char *set_num_option(int opt_idx, void *varp, long value, char *err
return errmsg; return errmsg;
} }
*pp = value; *pp = (OptInt)value;
// Remember where the option was set. // Remember where the option was set.
set_option_sctx_idx(opt_idx, opt_flags, current_sctx); set_option_sctx_idx(opt_idx, opt_flags, current_sctx);
@ -3182,7 +3181,7 @@ static const char *set_num_option(int opt_idx, void *varp, long value, char *err
.os_varp = varp, .os_varp = varp,
.os_flags = opt_flags, .os_flags = opt_flags,
.os_oldval.number = old_value, .os_oldval.number = old_value,
.os_newval.number = value, .os_newval.number = (OptInt)value,
.os_errbuf = NULL, .os_errbuf = NULL,
.os_errbuflen = 0, .os_errbuflen = 0,
.os_buf = curbuf, .os_buf = curbuf,
@ -3196,7 +3195,7 @@ static const char *set_num_option(int opt_idx, void *varp, long value, char *err
// May set global value for local option. // May set global value for local option.
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) { if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) {
*(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *pp; *(OptInt *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *pp;
} }
options[opt_idx].flags |= P_WAS_SET; options[opt_idx].flags |= P_WAS_SET;
@ -3581,7 +3580,7 @@ OptVal get_option_value(const char *name, uint32_t *flagsp, int scope, bool *hid
} }
if (options[opt_idx].flags & P_NUM) { if (options[opt_idx].flags & P_NUM) {
return NUMBER_OPTVAL(varp == NULL ? 0 : (*(long *)varp)); return NUMBER_OPTVAL(varp == NULL ? 0 : (*(OptInt *)varp));
} else { } else {
// Special case: 'modified' is b_changed, but we also want to consider // Special case: 'modified' is b_changed, but we also want to consider
// it set when 'ff' or 'fenc' changed. // it set when 'ff' or 'fenc' changed.
@ -3709,7 +3708,7 @@ int get_option_value_strict(char *name, int64_t *numval, char **stringval, int o
if (p->flags & P_STRING) { if (p->flags & P_STRING) {
*stringval = *(char **)(varp); *stringval = *(char **)(varp);
} else if (p->flags & P_NUM) { } else if (p->flags & P_NUM) {
*numval = *(long *)varp; *numval = *(OptInt *)varp;
} else { } else {
*numval = *(int *)varp; *numval = *(int *)varp;
} }
@ -3745,10 +3744,10 @@ static OptVal clear_optval(const char *name, uint32_t flags, void *varp, buf_T *
} }
} else if (flags & P_NUM) { } else if (flags & P_NUM) {
v.type = kOptValTypeNumber; v.type = kOptValTypeNumber;
if ((long *)varp == &curbuf->b_p_ul) { if ((OptInt *)varp == &curbuf->b_p_ul) {
// The one true special case // The one true special case
v.data.number = NO_LOCAL_UNDOLEVEL; v.data.number = NO_LOCAL_UNDOLEVEL;
} else if ((long *)varp == &win->w_p_so || (long *)varp == &win->w_p_siso) { } else if ((OptInt *)varp == &win->w_p_so || (OptInt *)varp == &win->w_p_siso) {
// TODO(lewis6991): replace this with a more general condition that // TODO(lewis6991): replace this with a more general condition that
// indicates we are setting the local value of a global-local option // indicates we are setting the local value of a global-local option
v.data.number = -1; v.data.number = -1;
@ -3996,7 +3995,7 @@ static int optval_default(vimoption_T *p, const void *varp)
return true; // hidden option is always at default return true; // hidden option is always at default
} }
if (p->flags & P_NUM) { if (p->flags & P_NUM) {
return *(long *)varp == (long)(intptr_t)p->def_val; return *(OptInt *)varp == (OptInt)(intptr_t)p->def_val;
} }
if (p->flags & P_BOOL) { if (p->flags & P_BOOL) {
return *(int *)varp == (int)(intptr_t)p->def_val; return *(int *)varp == (int)(intptr_t)p->def_val;
@ -4019,7 +4018,7 @@ void ui_refresh_options(void)
if (flags & P_BOOL) { if (flags & P_BOOL) {
value = BOOLEAN_OBJ(*(int *)varp); value = BOOLEAN_OBJ(*(int *)varp);
} else if (flags & P_NUM) { } else if (flags & P_NUM) {
value = INTEGER_OBJ(*(long *)varp); value = INTEGER_OBJ(*(OptInt *)varp);
} else if (flags & P_STRING) { } else if (flags & P_STRING) {
// cstr_as_string handles NULL string // cstr_as_string handles NULL string
value = CSTR_AS_OBJ(*(char **)varp); value = CSTR_AS_OBJ(*(char **)varp);
@ -4160,7 +4159,7 @@ int makeset(FILE *fd, int opt_flags, int local_only)
return FAIL; return FAIL;
} }
} else if (p->flags & P_NUM) { } else if (p->flags & P_NUM) {
if (put_setnum(fd, cmd, p->fullname, (long *)varp) == FAIL) { if (put_setnum(fd, cmd, p->fullname, (OptInt *)varp) == FAIL) {
return FAIL; return FAIL;
} }
} else { // P_STRING } else { // P_STRING
@ -4273,12 +4272,12 @@ fail:
return FAIL; return FAIL;
} }
static int put_setnum(FILE *fd, char *cmd, char *name, long *valuep) static int put_setnum(FILE *fd, char *cmd, char *name, OptInt *valuep)
{ {
if (fprintf(fd, "%s %s=", cmd, name) < 0) { if (fprintf(fd, "%s %s=", cmd, name) < 0) {
return FAIL; return FAIL;
} }
long wc; OptInt wc;
if (wc_use_keyname(valuep, &wc)) { if (wc_use_keyname(valuep, &wc)) {
// print 'wildchar' and 'wildcharm' as a key name // print 'wildchar' and 'wildcharm' as a key name
if (fputs(get_special_key_name((int)wc, 0), fd) < 0) { if (fputs(get_special_key_name((int)wc, 0), fd) < 0) {
@ -5647,7 +5646,7 @@ static void option_value2string(vimoption_T *opp, int scope)
void *varp = get_varp_scope(opp, scope); void *varp = get_varp_scope(opp, scope);
if (opp->flags & P_NUM) { if (opp->flags & P_NUM) {
long wc = 0; OptInt wc = 0;
if (wc_use_keyname(varp, &wc)) { if (wc_use_keyname(varp, &wc)) {
xstrlcpy(NameBuff, get_special_key_name((int)wc, 0), sizeof(NameBuff)); xstrlcpy(NameBuff, get_special_key_name((int)wc, 0), sizeof(NameBuff));
@ -5657,7 +5656,7 @@ static void option_value2string(vimoption_T *opp, int scope)
snprintf(NameBuff, snprintf(NameBuff,
sizeof(NameBuff), sizeof(NameBuff),
"%" PRId64, "%" PRId64,
(int64_t)(*(long *)varp)); (int64_t)(*(OptInt *)varp));
} }
} else { // P_STRING } else { // P_STRING
varp = *(char **)(varp); varp = *(char **)(varp);
@ -5674,10 +5673,10 @@ static void option_value2string(vimoption_T *opp, int scope)
/// Return true if "varp" points to 'wildchar' or 'wildcharm' and it can be /// Return true if "varp" points to 'wildchar' or 'wildcharm' and it can be
/// printed as a keyname. /// printed as a keyname.
/// "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'. /// "*wcp" is set to the value of the option if it's 'wildchar' or 'wildcharm'.
static int wc_use_keyname(const void *varp, long *wcp) static int wc_use_keyname(const void *varp, OptInt *wcp)
{ {
if (((long *)varp == &p_wc) || ((long *)varp == &p_wcm)) { if (((OptInt *)varp == &p_wc) || ((OptInt *)varp == &p_wcm)) {
*wcp = *(long *)varp; *wcp = *(OptInt *)varp;
if (IS_SPECIAL(*wcp) || find_special_key_in_table((int)(*wcp)) >= 0) { if (IS_SPECIAL(*wcp) || find_special_key_in_table((int)(*wcp)) >= 0) {
return true; return true;
} }
@ -6158,7 +6157,7 @@ dict_T *get_winbuf_options(const int bufopt)
*(const char **)varp); *(const char **)varp);
} else if (opt->flags & P_NUM) { } else if (opt->flags & P_NUM) {
tv_dict_add_nr(d, opt->fullname, strlen(opt->fullname), tv_dict_add_nr(d, opt->fullname, strlen(opt->fullname),
*(long *)varp); *(OptInt *)varp);
} else { } else {
tv_dict_add_nr(d, opt->fullname, strlen(opt->fullname), *(int *)varp); tv_dict_add_nr(d, opt->fullname, strlen(opt->fullname), *(int *)varp);
} }

View File

@ -390,7 +390,7 @@ EXTERN int p_bin; ///< 'binary'
EXTERN int p_bomb; ///< 'bomb' EXTERN int p_bomb; ///< 'bomb'
EXTERN int p_bl; ///< 'buflisted' EXTERN int p_bl; ///< 'buflisted'
EXTERN int p_cin; ///< 'cindent' EXTERN int p_cin; ///< 'cindent'
EXTERN long p_channel; ///< 'channel' EXTERN OptInt p_channel; ///< 'channel'
EXTERN char *p_cink; ///< 'cinkeys' EXTERN char *p_cink; ///< 'cinkeys'
EXTERN char *p_cinsd; ///< 'cinscopedecls' EXTERN char *p_cinsd; ///< 'cinscopedecls'
EXTERN char *p_cinw; ///< 'cinwords' EXTERN char *p_cinw; ///< 'cinwords'
@ -456,19 +456,19 @@ EXTERN unsigned cb_flags;
#define CB_UNNAMED 0x001 #define CB_UNNAMED 0x001
#define CB_UNNAMEDPLUS 0x002 #define CB_UNNAMEDPLUS 0x002
#define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS) #define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS)
EXTERN long p_cwh; // 'cmdwinheight' EXTERN OptInt p_cwh; // 'cmdwinheight'
EXTERN long p_ch; // 'cmdheight' EXTERN OptInt p_ch; // 'cmdheight'
EXTERN char *p_cms; ///< 'commentstring' EXTERN char *p_cms; ///< 'commentstring'
EXTERN char *p_cpt; ///< 'complete' EXTERN char *p_cpt; ///< 'complete'
EXTERN long p_columns; // 'columns' EXTERN OptInt p_columns; // 'columns'
EXTERN int p_confirm; // 'confirm' EXTERN int p_confirm; // 'confirm'
EXTERN char *p_cot; // 'completeopt' EXTERN char *p_cot; // 'completeopt'
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
EXTERN char *p_csl; // 'completeslash' EXTERN char *p_csl; // 'completeslash'
#endif #endif
EXTERN long p_pb; // 'pumblend' EXTERN OptInt p_pb; // 'pumblend'
EXTERN long p_ph; // 'pumheight' EXTERN OptInt p_ph; // 'pumheight'
EXTERN long p_pw; // 'pumwidth' EXTERN OptInt p_pw; // 'pumwidth'
EXTERN char *p_com; ///< 'comments' EXTERN char *p_com; ///< 'comments'
EXTERN char *p_cpo; // 'cpoptions' EXTERN char *p_cpo; // 'cpoptions'
EXTERN char *p_debug; // 'debug' EXTERN char *p_debug; // 'debug'
@ -510,7 +510,7 @@ EXTERN char *p_ft; ///< 'filetype'
EXTERN char *p_fcs; ///< 'fillchar' EXTERN char *p_fcs; ///< 'fillchar'
EXTERN int p_fixeol; ///< 'fixendofline' EXTERN int p_fixeol; ///< 'fixendofline'
EXTERN char *p_fcl; // 'foldclose' EXTERN char *p_fcl; // 'foldclose'
EXTERN long p_fdls; // 'foldlevelstart' EXTERN OptInt p_fdls; // 'foldlevelstart'
EXTERN char *p_fdo; // 'foldopen' EXTERN char *p_fdo; // 'foldopen'
EXTERN unsigned fdo_flags; EXTERN unsigned fdo_flags;
#define FDO_ALL 0x001 #define FDO_ALL 0x001
@ -534,18 +534,18 @@ EXTERN char *p_guicursor; // 'guicursor'
EXTERN char *p_guifont; // 'guifont' EXTERN char *p_guifont; // 'guifont'
EXTERN char *p_guifontwide; // 'guifontwide' EXTERN char *p_guifontwide; // 'guifontwide'
EXTERN char *p_hf; // 'helpfile' EXTERN char *p_hf; // 'helpfile'
EXTERN long p_hh; // 'helpheight' EXTERN OptInt p_hh; // 'helpheight'
EXTERN char *p_hlg; // 'helplang' EXTERN char *p_hlg; // 'helplang'
EXTERN int p_hid; // 'hidden' EXTERN int p_hid; // 'hidden'
EXTERN char *p_hl; // 'highlight' EXTERN char *p_hl; // 'highlight'
EXTERN int p_hls; // 'hlsearch' EXTERN int p_hls; // 'hlsearch'
EXTERN long p_hi; // 'history' EXTERN OptInt p_hi; // 'history'
EXTERN int p_arshape; // 'arabicshape' EXTERN int p_arshape; // 'arabicshape'
EXTERN int p_icon; // 'icon' EXTERN int p_icon; // 'icon'
EXTERN char *p_iconstring; // 'iconstring' EXTERN char *p_iconstring; // 'iconstring'
EXTERN int p_ic; // 'ignorecase' EXTERN int p_ic; // 'ignorecase'
EXTERN long p_iminsert; ///< 'iminsert' EXTERN OptInt p_iminsert; ///< 'iminsert'
EXTERN long p_imsearch; ///< 'imsearch' EXTERN OptInt p_imsearch; ///< 'imsearch'
EXTERN int p_inf; ///< 'infercase' EXTERN int p_inf; ///< 'infercase'
EXTERN char *p_inex; ///< 'includeexpr' EXTERN char *p_inex; ///< 'includeexpr'
EXTERN int p_is; // 'incsearch' EXTERN int p_is; // 'incsearch'
@ -568,13 +568,13 @@ EXTERN char *p_langmap; // 'langmap'
EXTERN int p_lnr; // 'langnoremap' EXTERN int p_lnr; // 'langnoremap'
EXTERN int p_lrm; // 'langremap' EXTERN int p_lrm; // 'langremap'
EXTERN char *p_lm; // 'langmenu' EXTERN char *p_lm; // 'langmenu'
EXTERN long p_lines; // 'lines' EXTERN OptInt p_lines; // 'lines'
EXTERN long p_linespace; // 'linespace' EXTERN OptInt p_linespace; // 'linespace'
EXTERN int p_lisp; ///< 'lisp' EXTERN int p_lisp; ///< 'lisp'
EXTERN char *p_lop; ///< 'lispoptions' EXTERN char *p_lop; ///< 'lispoptions'
EXTERN char *p_lispwords; // 'lispwords' EXTERN char *p_lispwords; // 'lispwords'
EXTERN long p_ls; // 'laststatus' EXTERN OptInt p_ls; // 'laststatus'
EXTERN long p_stal; // 'showtabline' EXTERN OptInt p_stal; // 'showtabline'
EXTERN char *p_lcs; // 'listchars' EXTERN char *p_lcs; // 'listchars'
EXTERN int p_lz; // 'lazyredraw' EXTERN int p_lz; // 'lazyredraw'
@ -584,16 +584,16 @@ EXTERN char *p_menc; // 'makeencoding'
EXTERN char *p_mef; // 'makeef' EXTERN char *p_mef; // 'makeef'
EXTERN char *p_mp; // 'makeprg' EXTERN char *p_mp; // 'makeprg'
EXTERN char *p_mps; ///< 'matchpairs' EXTERN char *p_mps; ///< 'matchpairs'
EXTERN long p_mat; // 'matchtime' EXTERN OptInt p_mat; // 'matchtime'
EXTERN long p_mco; // 'maxcombine' EXTERN OptInt p_mco; // 'maxcombine'
EXTERN long p_mfd; // 'maxfuncdepth' EXTERN OptInt p_mfd; // 'maxfuncdepth'
EXTERN long p_mmd; // 'maxmapdepth' EXTERN OptInt p_mmd; // 'maxmapdepth'
EXTERN long p_mmp; // 'maxmempattern' EXTERN OptInt p_mmp; // 'maxmempattern'
EXTERN long p_mis; // 'menuitems' EXTERN OptInt p_mis; // 'menuitems'
EXTERN char *p_msm; // 'mkspellmem' EXTERN char *p_msm; // 'mkspellmem'
EXTERN int p_ml; ///< 'modeline' EXTERN int p_ml; ///< 'modeline'
EXTERN int p_mle; // 'modelineexpr' EXTERN int p_mle; // 'modelineexpr'
EXTERN long p_mls; // 'modelines' EXTERN OptInt p_mls; // 'modelines'
EXTERN int p_ma; ///< 'modifiable' EXTERN int p_ma; ///< 'modifiable'
EXTERN int p_mod; ///< 'modified' EXTERN int p_mod; ///< 'modified'
EXTERN char *p_mouse; // 'mouse' EXTERN char *p_mouse; // 'mouse'
@ -601,9 +601,9 @@ EXTERN char *p_mousem; // 'mousemodel'
EXTERN int p_mousemev; ///< 'mousemoveevent' EXTERN int p_mousemev; ///< 'mousemoveevent'
EXTERN int p_mousef; // 'mousefocus' EXTERN int p_mousef; // 'mousefocus'
EXTERN char *p_mousescroll; // 'mousescroll' EXTERN char *p_mousescroll; // 'mousescroll'
EXTERN long p_mousescroll_vert INIT(= MOUSESCROLL_VERT_DFLT); EXTERN OptInt p_mousescroll_vert INIT(= MOUSESCROLL_VERT_DFLT);
EXTERN long p_mousescroll_hor INIT(= MOUSESCROLL_HOR_DFLT); EXTERN OptInt p_mousescroll_hor INIT(= MOUSESCROLL_HOR_DFLT);
EXTERN long p_mouset; // 'mousetime' EXTERN OptInt p_mouset; // 'mousetime'
EXTERN int p_more; // 'more' EXTERN int p_more; // 'more'
EXTERN char *p_nf; ///< 'nrformats' EXTERN char *p_nf; ///< 'nrformats'
EXTERN char *p_opfunc; // 'operatorfunc' EXTERN char *p_opfunc; // 'operatorfunc'
@ -614,7 +614,7 @@ EXTERN char *p_pm; // 'patchmode'
EXTERN char *p_path; // 'path' EXTERN char *p_path; // 'path'
EXTERN char *p_cdpath; // 'cdpath' EXTERN char *p_cdpath; // 'cdpath'
EXTERN int p_pi; ///< 'preserveindent' EXTERN int p_pi; ///< 'preserveindent'
EXTERN long p_pyx; // 'pyxversion' EXTERN OptInt p_pyx; // 'pyxversion'
EXTERN char *p_qe; ///< 'quoteescape' EXTERN char *p_qe; ///< 'quoteescape'
EXTERN int p_ro; ///< 'readonly' EXTERN int p_ro; ///< 'readonly'
EXTERN char *p_rdb; // 'redrawdebug' EXTERN char *p_rdb; // 'redrawdebug'
@ -627,10 +627,10 @@ EXTERN unsigned rdb_flags;
#define RDB_FLUSH 0x020 #define RDB_FLUSH 0x020
#define RDB_INTERSECT 0x040 #define RDB_INTERSECT 0x040
EXTERN long p_rdt; // 'redrawtime' EXTERN OptInt p_rdt; // 'redrawtime'
EXTERN long p_re; // 'regexpengine' EXTERN OptInt p_re; // 'regexpengine'
EXTERN long p_report; // 'report' EXTERN OptInt p_report; // 'report'
EXTERN long p_pvh; // 'previewheight' EXTERN OptInt p_pvh; // 'previewheight'
EXTERN int p_ari; // 'allowrevins' EXTERN int p_ari; // 'allowrevins'
EXTERN int p_ri; // 'revins' EXTERN int p_ri; // 'revins'
EXTERN int p_ru; // 'ruler' EXTERN int p_ru; // 'ruler'
@ -638,9 +638,9 @@ EXTERN char *p_ruf; // 'rulerformat'
EXTERN char *p_pp; // 'packpath' EXTERN char *p_pp; // 'packpath'
EXTERN char *p_qftf; // 'quickfixtextfunc' EXTERN char *p_qftf; // 'quickfixtextfunc'
EXTERN char *p_rtp; // 'runtimepath' EXTERN char *p_rtp; // 'runtimepath'
EXTERN long p_scbk; // 'scrollback' EXTERN OptInt p_scbk; // 'scrollback'
EXTERN long p_sj; // 'scrolljump' EXTERN OptInt p_sj; // 'scrolljump'
EXTERN long p_so; // 'scrolloff' EXTERN OptInt p_so; // 'scrolloff'
EXTERN char *p_sbo; // 'scrollopt' EXTERN char *p_sbo; // 'scrollopt'
EXTERN char *p_sections; // 'sections' EXTERN char *p_sections; // 'sections'
EXTERN int p_secure; // 'secure' EXTERN int p_secure; // 'secure'
@ -682,7 +682,7 @@ EXTERN int p_ssl; // 'shellslash'
EXTERN char *p_stl; // 'statusline' EXTERN char *p_stl; // 'statusline'
EXTERN char *p_wbr; // 'winbar' EXTERN char *p_wbr; // 'winbar'
EXTERN int p_sr; // 'shiftround' EXTERN int p_sr; // 'shiftround'
EXTERN long p_sw; ///< 'shiftwidth' EXTERN OptInt p_sw; ///< 'shiftwidth'
EXTERN char *p_shm; // 'shortmess' EXTERN char *p_shm; // 'shortmess'
EXTERN char *p_sbr; // 'showbreak' EXTERN char *p_sbr; // 'showbreak'
EXTERN int p_sc; // 'showcmd' EXTERN int p_sc; // 'showcmd'
@ -690,17 +690,17 @@ EXTERN char *p_sloc; // 'showcmdloc'
EXTERN int p_sft; // 'showfulltag' EXTERN int p_sft; // 'showfulltag'
EXTERN int p_sm; // 'showmatch' EXTERN int p_sm; // 'showmatch'
EXTERN int p_smd; // 'showmode' EXTERN int p_smd; // 'showmode'
EXTERN long p_ss; // 'sidescroll' EXTERN OptInt p_ss; // 'sidescroll'
EXTERN long p_siso; // 'sidescrolloff' EXTERN OptInt p_siso; // 'sidescrolloff'
EXTERN int p_scs; // 'smartcase' EXTERN int p_scs; // 'smartcase'
EXTERN int p_si; ///< 'smartindent' EXTERN int p_si; ///< 'smartindent'
EXTERN int p_sta; // 'smarttab' EXTERN int p_sta; // 'smarttab'
EXTERN long p_sts; ///< 'softtabstop' EXTERN OptInt p_sts; ///< 'softtabstop'
EXTERN int p_sb; // 'splitbelow' EXTERN int p_sb; // 'splitbelow'
EXTERN char *p_sua; ///< 'suffixesadd' EXTERN char *p_sua; ///< 'suffixesadd'
EXTERN int p_swf; ///< 'swapfile' EXTERN int p_swf; ///< 'swapfile'
EXTERN long p_smc; ///< 'synmaxcol' EXTERN OptInt p_smc; ///< 'synmaxcol'
EXTERN long p_tpm; // 'tabpagemax' EXTERN OptInt p_tpm; // 'tabpagemax'
EXTERN char *p_tal; // 'tabline' EXTERN char *p_tal; // 'tabline'
EXTERN char *p_tpf; // 'termpastefilter' EXTERN char *p_tpf; // 'termpastefilter'
EXTERN unsigned tpf_flags; ///< flags from 'termpastefilter' EXTERN unsigned tpf_flags; ///< flags from 'termpastefilter'
@ -732,7 +732,7 @@ EXTERN unsigned swb_flags;
#define SWB_VSPLIT 0x010 #define SWB_VSPLIT 0x010
#define SWB_USELAST 0x020 #define SWB_USELAST 0x020
EXTERN char *p_syn; ///< 'syntax' EXTERN char *p_syn; ///< 'syntax'
EXTERN long p_ts; ///< 'tabstop' EXTERN OptInt p_ts; ///< 'tabstop'
EXTERN int p_tbs; ///< 'tagbsearch' EXTERN int p_tbs; ///< 'tagbsearch'
EXTERN char *p_tc; ///< 'tagcase' EXTERN char *p_tc; ///< 'tagcase'
EXTERN unsigned tc_flags; ///< flags from 'tagcase' EXTERN unsigned tc_flags; ///< flags from 'tagcase'
@ -741,29 +741,29 @@ EXTERN unsigned tc_flags; ///< flags from 'tagcase'
#define TC_MATCH 0x04 #define TC_MATCH 0x04
#define TC_FOLLOWSCS 0x08 #define TC_FOLLOWSCS 0x08
#define TC_SMART 0x10 #define TC_SMART 0x10
EXTERN long p_tl; ///< 'taglength' EXTERN OptInt p_tl; ///< 'taglength'
EXTERN int p_tr; ///< 'tagrelative' EXTERN int p_tr; ///< 'tagrelative'
EXTERN char *p_tags; ///< 'tags' EXTERN char *p_tags; ///< 'tags'
EXTERN int p_tgst; ///< 'tagstack' EXTERN int p_tgst; ///< 'tagstack'
EXTERN int p_tbidi; ///< 'termbidi' EXTERN int p_tbidi; ///< 'termbidi'
EXTERN long p_tw; ///< 'textwidth' EXTERN OptInt p_tw; ///< 'textwidth'
EXTERN int p_to; ///< 'tildeop' EXTERN int p_to; ///< 'tildeop'
EXTERN int p_timeout; ///< 'timeout' EXTERN int p_timeout; ///< 'timeout'
EXTERN long p_tm; ///< 'timeoutlen' EXTERN OptInt p_tm; ///< 'timeoutlen'
EXTERN int p_title; ///< 'title' EXTERN int p_title; ///< 'title'
EXTERN long p_titlelen; ///< 'titlelen' EXTERN OptInt p_titlelen; ///< 'titlelen'
EXTERN char *p_titleold; ///< 'titleold' EXTERN char *p_titleold; ///< 'titleold'
EXTERN char *p_titlestring; ///< 'titlestring' EXTERN char *p_titlestring; ///< 'titlestring'
EXTERN char *p_tsr; ///< 'thesaurus' EXTERN char *p_tsr; ///< 'thesaurus'
EXTERN int p_tgc; ///< 'termguicolors' EXTERN int p_tgc; ///< 'termguicolors'
EXTERN int p_ttimeout; ///< 'ttimeout' EXTERN int p_ttimeout; ///< 'ttimeout'
EXTERN long p_ttm; ///< 'ttimeoutlen' EXTERN OptInt p_ttm; ///< 'ttimeoutlen'
EXTERN char *p_udir; ///< 'undodir' EXTERN char *p_udir; ///< 'undodir'
EXTERN int p_udf; ///< 'undofile' EXTERN int p_udf; ///< 'undofile'
EXTERN long p_ul; ///< 'undolevels' EXTERN OptInt p_ul; ///< 'undolevels'
EXTERN long p_ur; ///< 'undoreload' EXTERN OptInt p_ur; ///< 'undoreload'
EXTERN long p_uc; ///< 'updatecount' EXTERN OptInt p_uc; ///< 'updatecount'
EXTERN long p_ut; ///< 'updatetime' EXTERN OptInt p_ut; ///< 'updatetime'
EXTERN char *p_shada; ///< 'shada' EXTERN char *p_shada; ///< 'shada'
EXTERN char *p_shadafile; ///< 'shadafile' EXTERN char *p_shadafile; ///< 'shadafile'
EXTERN char *p_vsts; ///< 'varsofttabstop' EXTERN char *p_vsts; ///< 'varsofttabstop'
@ -780,7 +780,7 @@ EXTERN unsigned ve_flags;
#define VE_ONEMORE 8U #define VE_ONEMORE 8U
#define VE_NONE 16U // "none" #define VE_NONE 16U // "none"
#define VE_NONEU 32U // "NONE" #define VE_NONEU 32U // "NONE"
EXTERN long p_verbose; // 'verbose' EXTERN OptInt p_verbose; // 'verbose'
#ifdef IN_OPTION_C #ifdef IN_OPTION_C
char *p_vfile = ""; // used before options are initialized char *p_vfile = ""; // used before options are initialized
#else #else
@ -792,25 +792,25 @@ EXTERN unsigned wop_flags;
#define WOP_TAGFILE 0x01 #define WOP_TAGFILE 0x01
#define WOP_PUM 0x02 #define WOP_PUM 0x02
#define WOP_FUZZY 0x04 #define WOP_FUZZY 0x04
EXTERN long p_window; // 'window' EXTERN OptInt p_window; // 'window'
EXTERN char *p_wak; // 'winaltkeys' EXTERN char *p_wak; // 'winaltkeys'
EXTERN char *p_wig; // 'wildignore' EXTERN char *p_wig; // 'wildignore'
EXTERN char *p_ww; // 'whichwrap' EXTERN char *p_ww; // 'whichwrap'
EXTERN long p_wc; // 'wildchar' EXTERN OptInt p_wc; // 'wildchar'
EXTERN long p_wcm; // 'wildcharm' EXTERN OptInt p_wcm; // 'wildcharm'
EXTERN int p_wic; // 'wildignorecase' EXTERN int p_wic; // 'wildignorecase'
EXTERN char *p_wim; // 'wildmode' EXTERN char *p_wim; // 'wildmode'
EXTERN int p_wmnu; // 'wildmenu' EXTERN int p_wmnu; // 'wildmenu'
EXTERN long p_wh; // 'winheight' EXTERN OptInt p_wh; // 'winheight'
EXTERN long p_wmh; // 'winminheight' EXTERN OptInt p_wmh; // 'winminheight'
EXTERN long p_wmw; // 'winminwidth' EXTERN OptInt p_wmw; // 'winminwidth'
EXTERN long p_wiw; // 'winwidth' EXTERN OptInt p_wiw; // 'winwidth'
EXTERN long p_wm; ///< 'wrapmargin' EXTERN OptInt p_wm; ///< 'wrapmargin'
EXTERN int p_ws; // 'wrapscan' EXTERN int p_ws; // 'wrapscan'
EXTERN int p_write; // 'write' EXTERN int p_write; // 'write'
EXTERN int p_wa; // 'writeany' EXTERN int p_wa; // 'writeany'
EXTERN int p_wb; // 'writebackup' EXTERN int p_wb; // 'writebackup'
EXTERN long p_wd; // 'writedelay' EXTERN OptInt p_wd; // 'writedelay'
EXTERN int p_cdh; // 'cdhome' EXTERN int p_cdh; // 'cdhome'
EXTERN int p_force_on; ///< options that cannot be turned off. EXTERN int p_force_on; ///< options that cannot be turned off.
@ -978,7 +978,7 @@ enum {
// Argument for the callback function (opt_did_set_cb_T) invoked after an // Argument for the callback function (opt_did_set_cb_T) invoked after an
// option value is modified. // option value is modified.
typedef struct { typedef struct {
// Pointer to the option variable. The variable can be a long (numeric // Pointer to the option variable. The variable can be an OptInt (numeric
// option), an int (boolean option) or a char pointer (string option). // option), an int (boolean option) or a char pointer (string option).
void *os_varp; void *os_varp;
int os_idx; int os_idx;
@ -986,14 +986,14 @@ typedef struct {
// old value of the option (can be a string, number or a boolean) // old value of the option (can be a string, number or a boolean)
union { union {
const long number; const OptInt number;
const bool boolean; const bool boolean;
const char *string; const char *string;
} os_oldval; } os_oldval;
// new value of the option (can be a string, number or a boolean) // new value of the option (can be a string, number or a boolean)
union { union {
const long number; const OptInt number;
const bool boolean; const bool boolean;
const char *string; const char *string;
} os_newval; } os_newval;
@ -1091,7 +1091,7 @@ typedef struct {
union { union {
// Vim boolean options are actually tri-states because they have a third "None" value. // Vim boolean options are actually tri-states because they have a third "None" value.
TriState boolean; TriState boolean;
Integer number; OptInt number;
String string; String string;
} data; } data;
} OptVal; } OptVal;

View File

@ -527,8 +527,8 @@ static bool valid_filetype(const char *val)
/// @return error message, NULL if it's OK. /// @return error message, NULL if it's OK.
const char *did_set_mousescroll(optset_T *args FUNC_ATTR_UNUSED) const char *did_set_mousescroll(optset_T *args FUNC_ATTR_UNUSED)
{ {
long vertical = -1; OptInt vertical = -1;
long horizontal = -1; OptInt horizontal = -1;
char *string = p_mousescroll; char *string = p_mousescroll;
@ -542,7 +542,7 @@ const char *did_set_mousescroll(optset_T *args FUNC_ATTR_UNUSED)
return e_invarg; return e_invarg;
} }
long *direction; OptInt *direction;
if (memcmp(string, "ver:", 4) == 0) { if (memcmp(string, "ver:", 4) == 0) {
direction = &vertical; direction = &vertical;
@ -1944,7 +1944,7 @@ const char *did_set_varsofttabstop(optset_T *args)
return e_invarg; return e_invarg;
} }
long *oldarray = buf->b_p_vsts_array; colnr_T *oldarray = buf->b_p_vsts_array;
if (tabstop_set(*varp, &(buf->b_p_vsts_array))) { if (tabstop_set(*varp, &(buf->b_p_vsts_array))) {
xfree(oldarray); xfree(oldarray);
} else { } else {
@ -1975,7 +1975,7 @@ const char *did_set_vartabstop(optset_T *args)
return e_invarg; return e_invarg;
} }
long *oldarray = buf->b_p_vts_array; colnr_T *oldarray = buf->b_p_vts_array;
if (tabstop_set(*varp, &(buf->b_p_vts_array))) { if (tabstop_set(*varp, &(buf->b_p_vts_array))) {
xfree(oldarray); xfree(oldarray);
if (foldmethodIsIndent(win)) { if (foldmethodIsIndent(win)) {

View File

@ -476,7 +476,7 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *en
char *posptr; // points to char at pos->col char *posptr; // points to char at pos->col
int incr; int incr;
int head; int head;
long *vts = wp->w_buffer->b_p_vts_array; colnr_T *vts = wp->w_buffer->b_p_vts_array;
int ts = (int)wp->w_buffer->b_p_ts; int ts = (int)wp->w_buffer->b_p_ts;
colnr_T vcol = 0; colnr_T vcol = 0;

View File

@ -5187,7 +5187,7 @@ static buf_T *vgr_load_dummy_buf(char *fname, char *dirname_start, char *dirname
// indent scripts, a great speed improvement. // indent scripts, a great speed improvement.
char *save_ei = au_event_disable(",Filetype"); char *save_ei = au_event_disable(",Filetype");
long save_mls = p_mls; OptInt save_mls = p_mls;
p_mls = 0; p_mls = 0;
// Load file into a buffer, so that 'fileencoding' is detected, // Load file into a buffer, so that 'fileencoding' is detected,

View File

@ -6840,7 +6840,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
result = false; result = false;
win_T *wp = rex.reg_win == NULL ? curwin : rex.reg_win; win_T *wp = rex.reg_win == NULL ? curwin : rex.reg_win;
if (op == 1 && col - 1 > t->state->val && col > 100) { if (op == 1 && col - 1 > t->state->val && col > 100) {
long ts = wp->w_buffer->b_p_ts; long ts = (long)wp->w_buffer->b_p_ts;
// Guess that a character won't use more columns than 'tabstop', // Guess that a character won't use more columns than 'tabstop',
// with a minimum of 4. // with a minimum of 4.

View File

@ -2293,8 +2293,8 @@ void showmatch(int c)
{ {
pos_T *lpos; pos_T *lpos;
colnr_T vcol; colnr_T vcol;
long *so = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; OptInt *so = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so;
long *siso = curwin->w_p_siso >= 0 ? &curwin->w_p_siso : &p_siso; OptInt *siso = curwin->w_p_siso >= 0 ? &curwin->w_p_siso : &p_siso;
char *p; char *p;
// Only show match for chars in the 'matchpairs' option. // Only show match for chars in the 'matchpairs' option.
@ -2338,8 +2338,8 @@ void showmatch(int c)
pos_T mpos = *lpos; // save the pos, update_screen() may change it pos_T mpos = *lpos; // save the pos, update_screen() may change it
pos_T save_cursor = curwin->w_cursor; pos_T save_cursor = curwin->w_cursor;
long save_so = *so; OptInt save_so = *so;
long save_siso = *siso; OptInt save_siso = *siso;
// Handle "$" in 'cpo': If the ')' is typed on top of the "$", // Handle "$" in 'cpo': If the ')' is typed on top of the "$",
// stop displaying the "$". // stop displaying the "$".
if (dollar_vcol >= 0 && dollar_vcol == curwin->w_virtcol) { if (dollar_vcol >= 0 && dollar_vcol == curwin->w_virtcol) {

View File

@ -2506,7 +2506,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, ShaDaReadDef
for (HistoryType i = 0; i < HIST_COUNT; i++) { for (HistoryType i = 0; i < HIST_COUNT; i++) {
long num_saved = get_shada_parameter(hist_type2char(i)); long num_saved = get_shada_parameter(hist_type2char(i));
if (num_saved == -1) { if (num_saved == -1) {
num_saved = p_hi; num_saved = (long)p_hi;
} }
if (num_saved > 0) { if (num_saved > 0) {
dump_history = true; dump_history = true;

View File

@ -438,8 +438,8 @@ bool terminal_enter(void)
char *save_w_p_culopt = NULL; char *save_w_p_culopt = NULL;
uint8_t save_w_p_culopt_flags = curwin->w_p_culopt_flags; uint8_t save_w_p_culopt_flags = curwin->w_p_culopt_flags;
int save_w_p_cuc = curwin->w_p_cuc; int save_w_p_cuc = curwin->w_p_cuc;
long save_w_p_so = curwin->w_p_so; OptInt save_w_p_so = curwin->w_p_so;
long save_w_p_siso = curwin->w_p_siso; OptInt save_w_p_siso = curwin->w_p_siso;
if (curwin->w_p_cul && curwin->w_p_culopt_flags & CULOPT_NBR) { if (curwin->w_p_cul && curwin->w_p_culopt_flags & CULOPT_NBR) {
if (strcmp(curwin->w_p_culopt, "number") != 0) { if (strcmp(curwin->w_p_culopt, "number") != 0) {
save_w_p_culopt = curwin->w_p_culopt; save_w_p_culopt = curwin->w_p_culopt;

View File

@ -763,8 +763,8 @@ static void tinput_read_cb(Stream *stream, RBuffer *buf, size_t count_, void *da
if (rbuffer_size(input->read_stream.buffer)) { if (rbuffer_size(input->read_stream.buffer)) {
// If 'ttimeout' is not set, start the timer with a timeout of 0 to process // If 'ttimeout' is not set, start the timer with a timeout of 0 to process
// the next input. // the next input.
long ms = input->ttimeout ? int64_t ms = input->ttimeout ?
(input->ttimeoutlen >= 0 ? input->ttimeoutlen : 0) : 0; (input->ttimeoutlen >= 0 ? input->ttimeoutlen : 0) : 0;
// Stop the current timer if already running // Stop the current timer if already running
time_watcher_stop(&input->timer_handle); time_watcher_stop(&input->timer_handle);
time_watcher_start(&input->timer_handle, tinput_timer_cb, (uint32_t)ms, 0); time_watcher_start(&input->timer_handle, tinput_timer_cb, (uint32_t)ms, 0);

View File

@ -27,7 +27,7 @@ typedef struct term_input {
int8_t waiting_for_bg_response; int8_t waiting_for_bg_response;
int8_t waiting_for_csiu_response; int8_t waiting_for_csiu_response;
ExtkeysType extkeys_type; ExtkeysType extkeys_type;
long ttimeoutlen; OptInt ttimeoutlen;
TermKey *tk; TermKey *tk;
TermKey_Terminfo_Getstr_Hook *tk_ti_hook_fn; ///< libtermkey terminfo hook TermKey_Terminfo_Getstr_Hook *tk_ti_hook_fn; ///< libtermkey terminfo hook
TimeWatcher timer_handle; TimeWatcher timer_handle;

View File

@ -52,4 +52,6 @@ typedef struct Decoration Decoration;
# endif # endif
#endif #endif
typedef int64_t OptInt;
#endif // NVIM_TYPES_H #endif // NVIM_TYPES_H

View File

@ -439,7 +439,7 @@ void ui_line(ScreenGrid *grid, int row, int startcol, int endcol, int clearcol,
ui_call_grid_cursor_goto(grid->handle, row, ui_call_grid_cursor_goto(grid->handle, row,
MIN(clearcol, (int)grid->cols - 1)); MIN(clearcol, (int)grid->cols - 1));
ui_call_flush(); ui_call_flush();
uint64_t wd = (uint64_t)labs(p_wd); uint64_t wd = (uint64_t)llabs(p_wd);
os_sleep(wd); os_sleep(wd);
pending_cursor_update = true; // restore the cursor later pending_cursor_update = true; // restore the cursor later
} }
@ -522,7 +522,7 @@ void ui_flush(void)
ui_call_flush(); ui_call_flush();
if (p_wd && (rdb_flags & RDB_FLUSH)) { if (p_wd && (rdb_flags & RDB_FLUSH)) {
os_sleep((uint64_t)labs(p_wd)); os_sleep((uint64_t)llabs(p_wd));
} }
} }

View File

@ -461,7 +461,7 @@ static void compose_debug(Integer startrow, Integer endrow, Integer startcol, In
static void debug_delay(Integer lines) static void debug_delay(Integer lines)
{ {
ui_call_flush(); ui_call_flush();
uint64_t wd = (uint64_t)labs(p_wd); uint64_t wd = (uint64_t)llabs(p_wd);
uint64_t factor = (uint64_t)MAX(MIN(lines, 5), 1); uint64_t factor = (uint64_t)MAX(MIN(lines, 5), 1);
os_sleep(factor * wd); os_sleep(factor * wd);
} }

View File

@ -324,7 +324,7 @@ bool undo_allowed(buf_T *buf)
} }
/// Get the 'undolevels' value for the current buffer. /// Get the 'undolevels' value for the current buffer.
static long get_undolevel(buf_T *buf) static OptInt get_undolevel(buf_T *buf)
{ {
if (buf->b_p_ul == NO_LOCAL_UNDOLEVEL) { if (buf->b_p_ul == NO_LOCAL_UNDOLEVEL) {
return p_ul; return p_ul;

View File

@ -5741,7 +5741,7 @@ void win_size_restore(garray_T *gap)
{ {
if (win_count() * 2 + 1 == gap->ga_len if (win_count() * 2 + 1 == gap->ga_len
&& ((int *)gap->ga_data)[0] == && ((int *)gap->ga_data)[0] ==
(int)ROWS_AVAIL + global_stl_height() - last_stl_height(false)) { ROWS_AVAIL + global_stl_height() - last_stl_height(false)) {
// The order matters, because frames contain other frames, but it's // The order matters, because frames contain other frames, but it's
// difficult to get right. The easy way out is to do it twice. // difficult to get right. The easy way out is to do it twice.
for (int j = 0; j < 2; j++) { for (int j = 0; j < 2; j++) {
@ -6764,7 +6764,7 @@ void win_new_width(win_T *wp, int width)
void win_comp_scroll(win_T *wp) void win_comp_scroll(win_T *wp)
{ {
const long old_w_p_scr = wp->w_p_scr; const OptInt old_w_p_scr = wp->w_p_scr;
wp->w_p_scr = wp->w_height_inner / 2; wp->w_p_scr = wp->w_height_inner / 2;
if (wp->w_p_scr == 0) { if (wp->w_p_scr == 0) {

View File

@ -73,6 +73,7 @@ describe('TUI', function()
end end
it('rapid resize #7572 #7628', function() it('rapid resize #7572 #7628', function()
helpers.skip(helpers.is_asan(), 'Test extra unstable with ASAN. See #23762')
-- Need buffer rows to provoke the behavior. -- Need buffer rows to provoke the behavior.
feed_data(":edit test/functional/fixtures/bigfile.txt\n") feed_data(":edit test/functional/fixtures/bigfile.txt\n")
screen:expect([[ screen:expect([[