aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/autocmd.c2
-rw-r--r--src/nvim/buffer.c10
-rw-r--r--src/nvim/change.c8
-rw-r--r--src/nvim/cmdexpand.c6
-rw-r--r--src/nvim/diff.c4
-rw-r--r--src/nvim/drawline.c26
-rw-r--r--src/nvim/edit.c14
-rw-r--r--src/nvim/eval/buffer.c4
-rw-r--r--src/nvim/eval/funcs.c19
-rw-r--r--src/nvim/eval/window.c2
-rw-r--r--src/nvim/ex_cmds.c15
-rw-r--r--src/nvim/ex_docmd.c24
-rw-r--r--src/nvim/ex_docmd.h2
-rw-r--r--src/nvim/ex_getln.c10
-rw-r--r--src/nvim/globals.h4
-rw-r--r--src/nvim/match.c20
-rw-r--r--src/nvim/memline.c26
-rw-r--r--src/nvim/mouse.c10
-rw-r--r--src/nvim/move.c6
-rw-r--r--src/nvim/normal.c100
-rw-r--r--src/nvim/normal.h10
-rw-r--r--src/nvim/ops.c4
-rw-r--r--src/nvim/option.c4
-rw-r--r--src/nvim/search.c16
-rw-r--r--src/nvim/spellfile.c4
-rw-r--r--src/nvim/statusline.c2
-rw-r--r--src/nvim/tag.c13
-rw-r--r--src/nvim/terminal.c2
-rw-r--r--src/nvim/textobject.c34
-rw-r--r--src/nvim/undo.c2
-rw-r--r--src/nvim/undo_defs.h2
-rw-r--r--src/nvim/window.c66
32 files changed, 234 insertions, 237 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 36f0183fd8..4aa2ec56a4 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -1551,7 +1551,7 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
bool retval = false;
static int nesting = 0;
char *save_cmdarg;
- long save_cmdbang;
+ varnumber_T save_cmdbang;
static int filechangeshell_busy = false;
proftime_T wait_time;
bool did_save_redobuff = false;
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index a07b1c5720..fd912a65e0 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3192,12 +3192,12 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate)
? " " : "");
// With 32 bit longs and more than 21,474,836 lines multiplying by 100
// causes an overflow, thus for large numbers divide instead.
- if (curwin->w_cursor.lnum > 1000000L) {
- n = (int)(((long)curwin->w_cursor.lnum) /
- ((long)curbuf->b_ml.ml_line_count / 100L));
+ if (curwin->w_cursor.lnum > 1000000) {
+ n = ((curwin->w_cursor.lnum) /
+ (curbuf->b_ml.ml_line_count / 100));
} else {
- n = (int)(((long)curwin->w_cursor.lnum * 100L) /
- (long)curbuf->b_ml.ml_line_count);
+ n = ((curwin->w_cursor.lnum * 100) /
+ curbuf->b_ml.ml_line_count);
}
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
vim_snprintf_add(buffer, IOSIZE, "%s", _(no_lines_msg));
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 9e1767c2f3..932de727b5 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -441,7 +441,7 @@ void appended_lines(linenr_T lnum, linenr_T count)
}
/// Like appended_lines(), but adjust marks first.
-void appended_lines_mark(linenr_T lnum, long count)
+void appended_lines_mark(linenr_T lnum, int count)
{
mark_adjust(lnum + 1, (linenr_T)MAXLNUM, (linenr_T)count, 0L, kExtmarkUndo);
changed_lines(lnum + 1, 0, lnum + 1, (linenr_T)count, true);
@@ -458,7 +458,7 @@ void deleted_lines(linenr_T lnum, linenr_T count)
/// Like deleted_lines(), but adjust marks first.
/// Make sure the cursor is on a valid line before calling, a GUI callback may
/// be triggered to display the cursor.
-void deleted_lines_mark(linenr_T lnum, long count)
+void deleted_lines_mark(linenr_T lnum, int count)
{
bool made_empty = (count > 0) && curbuf->b_ml.ml_flags & ML_EMPTY;
@@ -812,7 +812,7 @@ int del_char(bool fixpos)
}
/// Like del_bytes(), but delete characters instead of bytes.
-int del_chars(long count, int fixpos)
+int del_chars(int count, int fixpos)
{
int bytes = 0;
char *p = get_cursor_pos_ptr();
@@ -1928,7 +1928,7 @@ void truncate_line(int fixpos)
/// Saves the lines for undo first if "undo" is true.
void del_lines(long nlines, bool undo)
{
- long n;
+ int n;
linenr_T first = curwin->w_cursor.lnum;
if (nlines <= 0) {
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index b2835cae0f..47c69ed6f8 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -483,13 +483,13 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
clen += 2;
}
// jumping right, put match at the left
- if ((long)clen > Columns) {
+ if (clen > Columns) {
first_match = match;
// if showing the last match, we can add some on the left
clen = 2;
for (i = match; i < num_matches; i++) {
clen += wildmenu_match_len(xp, SHOW_MATCH(i)) + 2;
- if ((long)clen >= Columns) {
+ if (clen >= Columns) {
break;
}
}
@@ -501,7 +501,7 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
if (add_left) {
while (first_match > 0) {
clen += wildmenu_match_len(xp, SHOW_MATCH(first_match - 1)) + 2;
- if ((long)clen >= Columns) {
+ if (clen >= Columns) {
break;
}
first_match--;
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 810f631a02..64e47cbeb8 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -2466,8 +2466,8 @@ int diffopt_changed(void)
int linematch_lines_new = 0;
int diff_flags_new = 0;
int diff_foldcolumn_new = 2;
- long diff_algorithm_new = 0;
- long diff_indent_heuristic = 0;
+ int diff_algorithm_new = 0;
+ int diff_indent_heuristic = 0;
char *p = p_dip;
while (*p != NUL) {
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index c04ee0c222..fbce0914cb 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -553,19 +553,19 @@ int win_signcol_width(win_T *wp)
static inline void get_line_number_str(win_T *wp, linenr_T lnum, char *buf, size_t buf_len)
{
- long num;
- char *fmt = "%*ld ";
+ linenr_T num;
+ char *fmt = "%*" PRIdLINENR " ";
if (wp->w_p_nu && !wp->w_p_rnu) {
// 'number' + 'norelativenumber'
- num = (long)lnum;
+ num = lnum;
} else {
// 'relativenumber', don't use negative numbers
- num = labs((long)get_cursor_rel_lnum(wp, lnum));
+ num = abs(get_cursor_rel_lnum(wp, lnum));
if (num == 0 && wp->w_p_nu && wp->w_p_rnu) {
// 'number' + 'relativenumber'
num = lnum;
- fmt = "%-*ld ";
+ fmt = "%-*" PRIdLINENR " ";
}
}
@@ -673,7 +673,7 @@ static void handle_lnum_col(win_T *wp, winlinevars_T *wlv, int num_signs, int si
static void get_statuscol_str(win_T *wp, linenr_T lnum, int virtnum, statuscol_T *stcp)
{
// When called for the first non-filler row of line "lnum" set num v:vars
- long relnum = virtnum == 0 ? labs(get_cursor_rel_lnum(wp, lnum)) : -1;
+ linenr_T relnum = virtnum == 0 ? abs(get_cursor_rel_lnum(wp, lnum)) : -1;
// When a buffer's line count has changed, make a best estimate for the full
// width of the status column by building with "w_nrwidth_line_count". Add
@@ -1088,7 +1088,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
winlinevars_T wlv; // variables passed between functions
int c = 0; // init for GCC
- long vcol_prev = -1; // "wlv.vcol" of previous character
+ colnr_T vcol_prev = -1; // "wlv.vcol" of previous character
char *line; // current line
char *ptr; // current position in "line"
ScreenGrid *grid = &wp->w_grid; // grid specific to the window
@@ -1469,7 +1469,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
nextlinecol = MAXCOL;
nextline_idx = 0;
} else {
- v = (long)strlen(line);
+ v = (ptrdiff_t)strlen(line);
if (v < SPWORDLEN) {
// Short line, use it completely and append the start of the
// next line.
@@ -1779,7 +1779,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
if (((dollar_vcol >= 0
&& wp == curwin
&& lnum == wp->w_cursor.lnum
- && wlv.vcol >= (long)wp->w_virtcol)
+ && wlv.vcol >= wp->w_virtcol)
|| (number_only && wlv.draw_state > WL_STC))
&& wlv.filler_todo <= 0) {
draw_virt_text(wp, buf, win_col_offset, &wlv.col, grid->cols, wlv.row);
@@ -2396,7 +2396,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
// turn it into something else on the way to putting it on the screen.
if (c == TAB && (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) {
int tab_len = 0;
- long vcol_adjusted = wlv.vcol; // removed showbreak length
+ colnr_T vcol_adjusted = wlv.vcol; // removed showbreak length
char *const sbr = get_showbreak_value(wp);
// Only adjust the tab_len, when at the first column after the
@@ -2405,7 +2405,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
vcol_adjusted = wlv.vcol - mb_charlen(sbr);
}
// tab amount depends on current column
- tab_len = tabstop_padding((colnr_T)vcol_adjusted,
+ tab_len = tabstop_padding(vcol_adjusted,
wp->w_buffer->b_p_ts,
wp->w_buffer->b_p_vts_array) - 1;
@@ -2705,7 +2705,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
// flag to indicate whether prevcol equals startcol of search_hl or
// one of the matches
bool prevcol_hl_flag = get_prevcol_hl_flag(wp, &screen_search_hl,
- (long)(ptr - line) - 1); // NOLINT(google-readability-casting)
+ (colnr_T)(ptr - line) - 1);
// Invert at least one char, used for Visual and empty line or
// highlight match at end of line. If it's beyond the last
@@ -2743,7 +2743,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
// 'search_hl' and the match list.
get_search_match_hl(wp,
&screen_search_hl,
- (long)(ptr - line), // NOLINT(google-readability-casting)
+ (colnr_T)(ptr - line),
&wlv.char_attr);
}
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 6b90c40c7c..7b605aa970 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -2549,7 +2549,7 @@ int oneleft(void)
/// Move the cursor up "n" lines in window "wp".
/// Takes care of closed folds.
-void cursor_up_inner(win_T *wp, long n)
+void cursor_up_inner(win_T *wp, linenr_T n)
{
linenr_T lnum = wp->w_cursor.lnum;
@@ -2578,14 +2578,14 @@ void cursor_up_inner(win_T *wp, long n)
lnum = 1;
}
} else {
- lnum -= (linenr_T)n;
+ lnum -= n;
}
wp->w_cursor.lnum = lnum;
}
/// @param upd_topline When true: update topline
-int cursor_up(long n, int upd_topline)
+int cursor_up(linenr_T n, int upd_topline)
{
// This fails if the cursor is already in the first line.
if (n > 0 && curwin->w_cursor.lnum <= 1) {
@@ -4042,9 +4042,9 @@ static void ins_mousescroll(int dir)
if (!pum_visible() || curwin != old_curwin) {
if (dir == MSCR_DOWN || dir == MSCR_UP) {
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
- scroll_redraw(dir, (long)(curwin->w_botline - curwin->w_topline));
+ scroll_redraw(dir, curwin->w_botline - curwin->w_topline);
} else if (p_mousescroll_vert > 0) {
- scroll_redraw(dir, p_mousescroll_vert);
+ scroll_redraw(dir, (linenr_T)p_mousescroll_vert);
}
} else {
mouse_scroll_horiz(dir);
@@ -4250,7 +4250,7 @@ static void ins_pageup(void)
}
tpos = curwin->w_cursor;
- if (onepage(BACKWARD, 1L) == OK) {
+ if (onepage(BACKWARD, 1) == OK) {
start_arrow(&tpos);
can_cindent = true;
} else {
@@ -4298,7 +4298,7 @@ static void ins_pagedown(void)
}
tpos = curwin->w_cursor;
- if (onepage(FORWARD, 1L) == OK) {
+ if (onepage(FORWARD, 1) == OK) {
start_arrow(&tpos);
can_cindent = true;
} else {
diff --git a/src/nvim/eval/buffer.c b/src/nvim/eval/buffer.c
index aad88619b7..0fe3f5444c 100644
--- a/src/nvim/eval/buffer.c
+++ b/src/nvim/eval/buffer.c
@@ -126,7 +126,7 @@ static void set_buffer_lines(buf_T *buf, linenr_T lnum_arg, bool append, typval_
FUNC_ATTR_NONNULL_ARG(4, 5)
{
linenr_T lnum = lnum_arg + (append ? 1 : 0);
- long added = 0;
+ int added = 0;
// When using the current buffer ml_mfp will be set if needed. Useful when
// setline() is used on startup. For other buffers the buffer must be
@@ -442,7 +442,7 @@ void f_deletebufline(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (last > curbuf->b_ml.ml_line_count) {
last = curbuf->b_ml.ml_line_count;
}
- const long count = last - first + 1;
+ const int count = last - first + 1;
// When coming here from Insert mode, sync undo, so that this can be
// undone separately from what was previously inserted.
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index f53c5fc0c5..f348a61075 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -886,7 +886,7 @@ static void f_copy(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// "count()" function
static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
- long n = 0;
+ varnumber_T n = 0;
int ic = 0;
bool error = false;
@@ -1085,8 +1085,9 @@ static void f_ctxsize(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// Otherwise use the column number as a byte offset.
static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
{
- long lnum, col;
- long coladd = 0;
+ linenr_T lnum;
+ colnr_T col;
+ colnr_T coladd = 0;
bool set_curswant = true;
rettv->vval.v_number = -1;
@@ -1114,12 +1115,12 @@ static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
} else if (lnum == 0) {
lnum = curwin->w_cursor.lnum;
}
- col = (long)tv_get_number_chk(&argvars[1], NULL);
+ col = (colnr_T)tv_get_number_chk(&argvars[1], NULL);
if (charcol) {
- col = buf_charidx_to_byteidx(curbuf, (linenr_T)lnum, (int)col) + 1;
+ col = buf_charidx_to_byteidx(curbuf, lnum, (int)col) + 1;
}
if (argvars[2].v_type != VAR_UNKNOWN) {
- coladd = (long)tv_get_number_chk(&argvars[2], NULL);
+ coladd = (colnr_T)tv_get_number_chk(&argvars[2], NULL);
}
} else {
emsg(_(e_invarg));
@@ -1129,12 +1130,12 @@ static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
return; // type error; errmsg already given
}
if (lnum > 0) {
- curwin->w_cursor.lnum = (linenr_T)lnum;
+ curwin->w_cursor.lnum = lnum;
}
if (col > 0) {
- curwin->w_cursor.col = (colnr_T)col - 1;
+ curwin->w_cursor.col = col - 1;
}
- curwin->w_cursor.coladd = (colnr_T)coladd;
+ curwin->w_cursor.coladd = coladd;
// Make sure the cursor is in a valid position.
check_cursor();
diff --git a/src/nvim/eval/window.c b/src/nvim/eval/window.c
index 30c295de46..26f5414565 100644
--- a/src/nvim/eval/window.c
+++ b/src/nvim/eval/window.c
@@ -266,7 +266,7 @@ static int get_winnr(tabpage_T *tp, typval_T *argvar)
} else {
// Extract the window count (if specified). e.g. winnr('3j')
char *endp;
- long count = strtol(arg, &endp, 10);
+ int count = (int)strtol(arg, &endp, 10);
if (count <= 0) {
// if count is not specified, default to 1
count = 1;
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 591f8febdc..68f9aa87ee 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -462,7 +462,7 @@ void ex_sort(exarg_T *eap)
char *s2;
char c; // temporary character storage
bool unique = false;
- long deleted;
+ linenr_T deleted;
colnr_T start_col;
colnr_T end_col;
int sort_what = 0;
@@ -689,13 +689,12 @@ void ex_sort(exarg_T *eap)
}
// Adjust marks for deleted (or added) lines and prepare for displaying.
- deleted = (long)count - (lnum - eap->line2);
+ deleted = (linenr_T)count - (lnum - eap->line2);
if (deleted > 0) {
- mark_adjust(eap->line2 - (linenr_T)deleted, eap->line2, (long)MAXLNUM, (linenr_T)(-deleted),
- kExtmarkNOOP);
+ mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted, kExtmarkNOOP);
msgmore(-deleted);
} else if (deleted < 0) {
- mark_adjust(eap->line2, MAXLNUM, (linenr_T)(-deleted), 0L, kExtmarkNOOP);
+ mark_adjust(eap->line2, MAXLNUM, -deleted, 0L, kExtmarkNOOP);
}
if (change_occurred || deleted != 0) {
@@ -703,7 +702,7 @@ void ex_sort(exarg_T *eap)
(int)count, 0, old_count,
lnum - eap->line2, 0, new_count, kExtmarkUndo);
- changed_lines(eap->line1, 0, eap->line2 + 1, (linenr_T)(-deleted), true);
+ changed_lines(eap->line1, 0, eap->line2 + 1, -deleted, true);
}
curwin->w_cursor.lnum = eap->line1;
@@ -3900,7 +3899,7 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const long cmdpreview_
// 3. Substitute the string. During 'inccommand' preview only do this if
// there is a replace pattern.
if (cmdpreview_ns <= 0 || has_second_delim) {
- long lnum_start = lnum; // save the start lnum
+ linenr_T lnum_start = lnum; // save the start lnum
int save_ma = curbuf->b_p_ma;
int save_sandbox = sandbox;
if (subflags.do_count) {
@@ -4038,7 +4037,7 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const long cmdpreview_
}
extmark_splice(curbuf, (int)lnum_start - 1, start_col,
end.lnum - start.lnum, matchcols, replaced_bytes,
- lnum - (linenr_T)lnum_start, subcols, sublen - 1, kExtmarkUndo);
+ lnum - lnum_start, subcols, sublen - 1, kExtmarkUndo);
}
// 4. If subflags.do_all is set, find next match.
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index a70b3b1893..b3181e1b18 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -999,10 +999,10 @@ void *getline_cookie(LineGetter fgetline, void *cookie)
/// ":bwipeout", etc.
///
/// @return the buffer number.
-static int compute_buffer_local_count(cmd_addr_T addr_type, linenr_T lnum, long offset)
+static int compute_buffer_local_count(cmd_addr_T addr_type, linenr_T lnum, int offset)
{
buf_T *nextbuf;
- long count = offset;
+ int count = offset;
buf_T *buf = firstbuf;
while (buf->b_next != NULL && buf->b_fnum < lnum) {
@@ -5391,8 +5391,8 @@ static void ex_syncbind(exarg_T *eap)
{
win_T *save_curwin = curwin;
buf_T *save_curbuf = curbuf;
- long topline;
- long y;
+ linenr_T topline;
+ int y;
linenr_T old_linenr = curwin->w_cursor.lnum;
setpcmark();
@@ -5719,7 +5719,7 @@ static void ex_sleep(exarg_T *eap)
setcursor_mayforce(true);
}
- long len = eap->line2;
+ linenr_T len = eap->line2;
switch (*eap->arg) {
case 'm':
break;
@@ -5732,7 +5732,7 @@ static void ex_sleep(exarg_T *eap)
}
/// Sleep for "msec" milliseconds, but return early on CTRL-C.
-void do_sleep(long msec)
+void do_sleep(int64_t msec)
{
ui_flush(); // flush before waiting
LOOP_PROCESS_EVENTS_UNTIL(&main_loop, main_loop.events, msec, got_int);
@@ -5860,7 +5860,7 @@ static void ex_put(exarg_T *eap)
static void ex_copymove(exarg_T *eap)
{
const char *errormsg = NULL;
- long n = get_address(eap, &eap->arg, eap->addr_type, false, false, false, 1, &errormsg);
+ linenr_T n = get_address(eap, &eap->arg, eap->addr_type, false, false, false, 1, &errormsg);
if (eap->arg == NULL) { // error detected
if (errormsg != NULL) {
emsg(errormsg);
@@ -5877,11 +5877,11 @@ static void ex_copymove(exarg_T *eap)
}
if (eap->cmdidx == CMD_move) {
- if (do_move(eap->line1, eap->line2, (linenr_T)n) == FAIL) {
+ if (do_move(eap->line1, eap->line2, n) == FAIL) {
return;
}
} else {
- ex_copy(eap->line1, eap->line2, (linenr_T)n);
+ ex_copy(eap->line1, eap->line2, n);
}
u_clearline();
beginline(BL_SOL | BL_FIX);
@@ -5991,7 +5991,7 @@ static void ex_undo(exarg_T *eap)
return;
}
- long step = eap->line2;
+ linenr_T step = eap->line2;
if (eap->forceit) { // undo! 123
// change number for "undo!" must be lesser than current change number
@@ -6579,9 +6579,9 @@ static void ex_findpat(exarg_T *eap)
break;
}
- long n = 1;
+ int n = 1;
if (ascii_isdigit(*eap->arg)) { // get count
- n = getdigits_long(&eap->arg, false, 0);
+ n = getdigits_int(&eap->arg, false, 0);
eap->arg = skipwhite(eap->arg);
}
if (*eap->arg == '/') { // Match regexp, not just whole words
diff --git a/src/nvim/ex_docmd.h b/src/nvim/ex_docmd.h
index 19dd9e96ca..711fc4ba52 100644
--- a/src/nvim/ex_docmd.h
+++ b/src/nvim/ex_docmd.h
@@ -30,7 +30,7 @@ typedef struct {
bool save_msg_didout;
int save_State;
bool save_finish_op;
- long save_opcount;
+ int save_opcount;
int save_reg_executing;
bool save_pending_end_reg_executing;
tasave_T tabuf;
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index f77822cec6..6bb980d501 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -104,7 +104,7 @@ typedef struct {
typedef struct command_line_state {
VimState state;
int firstc;
- long count;
+ int count;
int indent;
int c;
int gotesc; // true when <ESC> just typed
@@ -372,7 +372,7 @@ theend:
}
// May do 'incsearch' highlighting if desired.
-static void may_do_incsearch_highlighting(int firstc, long count, incsearch_state_T *s)
+static void may_do_incsearch_highlighting(int firstc, int count, incsearch_state_T *s)
{
pos_T end_pos;
proftime_T tm;
@@ -640,7 +640,7 @@ static void init_ccline(int firstc, int indent)
/// @param count only used for incremental search
/// @param indent indent for inside conditionals
/// @param clear_ccline clear ccline first
-static uint8_t *command_line_enter(int firstc, long count, int indent, bool clear_ccline)
+static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear_ccline)
{
// can be invoked recursively, identify each level
static int cmdline_level = 0;
@@ -1344,7 +1344,7 @@ static int command_line_execute(VimState *state, int key)
// May adjust 'incsearch' highlighting for typing CTRL-G and CTRL-T, go to next
// or previous match.
// Returns FAIL when calling command_line_not_changed.
-static int may_do_command_line_next_incsearch(int firstc, long count, incsearch_state_T *s,
+static int may_do_command_line_next_incsearch(int firstc, int count, incsearch_state_T *s,
bool next_match)
FUNC_ATTR_NONNULL_ALL
{
@@ -2619,7 +2619,7 @@ static void abandon_cmdline(void)
///
/// @param count only used for incremental search
/// @param indent indent for inside conditionals
-char *getcmdline(int firstc, long count, int indent, bool do_concat FUNC_ATTR_UNUSED)
+char *getcmdline(int firstc, int count, int indent, bool do_concat FUNC_ATTR_UNUSED)
{
return (char *)command_line_enter(firstc, count, indent, true);
}
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index f2c9aea675..dc7753f222 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -638,8 +638,8 @@ EXTERN int State INIT(= MODE_NORMAL);
EXTERN bool debug_mode INIT(= false);
EXTERN bool finish_op INIT(= false); // true while an operator is pending
-EXTERN long opcount INIT(= 0); // count for pending operator
-EXTERN int motion_force INIT(= 0); // motion force for pending operator
+EXTERN int opcount INIT(= 0); // count for pending operator
+EXTERN int motion_force INIT(= 0); // motion force for pending operator
// Ex Mode (Q) state
EXTERN bool exmode_active INIT(= false); // true if Ex mode is active
diff --git a/src/nvim/match.c b/src/nvim/match.c
index 6903c0a851..ece4de2199 100644
--- a/src/nvim/match.c
+++ b/src/nvim/match.c
@@ -658,7 +658,7 @@ bool prepare_search_hl_line(win_T *wp, linenr_T lnum, colnr_T mincol, char **lin
shl->endcol++;
}
}
- if ((long)shl->startcol < mincol) { // match at leftcol
+ if (shl->startcol < mincol) { // match at leftcol
shl->attr_cur = shl->attr;
*search_attr = shl->attr;
*search_attr_from_match = shl != search_hl;
@@ -808,28 +808,28 @@ int update_search_hl(win_T *wp, linenr_T lnum, colnr_T col, char **line, match_T
return search_attr;
}
-bool get_prevcol_hl_flag(win_T *wp, match_T *search_hl, long curcol)
+bool get_prevcol_hl_flag(win_T *wp, match_T *search_hl, colnr_T curcol)
{
- long prevcol = curcol;
+ colnr_T prevcol = curcol;
matchitem_T *cur; // points to the match list
// we're not really at that column when skipping some text
- if ((long)(wp->w_p_wrap ? wp->w_skipcol : wp->w_leftcol) > prevcol) {
+ if ((wp->w_p_wrap ? wp->w_skipcol : wp->w_leftcol) > prevcol) {
prevcol++;
}
// Highlight a character after the end of the line if the match started
// at the end of the line or when the match continues in the next line
// (match includes the line break).
- if (!search_hl->is_addpos && (prevcol == (long)search_hl->startcol
- || (prevcol > (long)search_hl->startcol
+ if (!search_hl->is_addpos && (prevcol == search_hl->startcol
+ || (prevcol > search_hl->startcol
&& search_hl->endcol == MAXCOL))) {
return true;
}
cur = wp->w_match_head;
while (cur != NULL) {
- if (!cur->mit_hl.is_addpos && (prevcol == (long)cur->mit_hl.startcol
- || (prevcol > (long)cur->mit_hl.startcol
+ if (!cur->mit_hl.is_addpos && (prevcol == cur->mit_hl.startcol
+ || (prevcol > cur->mit_hl.startcol
&& cur->mit_hl.endcol == MAXCOL))) {
return true;
}
@@ -841,7 +841,7 @@ bool get_prevcol_hl_flag(win_T *wp, match_T *search_hl, long curcol)
/// Get highlighting for the char after the text in "char_attr" from 'hlsearch'
/// or match highlighting.
-void get_search_match_hl(win_T *wp, match_T *search_hl, long col, int *char_attr)
+void get_search_match_hl(win_T *wp, match_T *search_hl, colnr_T col, int *char_attr)
{
matchitem_T *cur = wp->w_match_head; // points to the match list
match_T *shl; // points to search_hl or a match
@@ -856,7 +856,7 @@ void get_search_match_hl(win_T *wp, match_T *search_hl, long col, int *char_attr
} else {
shl = &cur->mit_hl;
}
- if (col - 1 == (long)shl->startcol
+ if (col - 1 == shl->startcol
&& (shl == search_hl || !shl->is_addpos)) {
*char_attr = shl->attr;
}
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 8f5a957846..d48eee7ea2 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -962,14 +962,14 @@ void ml_recover(bool checkext)
// Now that we are sure that the file is going to be recovered, clear the
// contents of the current buffer.
while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) {
- ml_delete((linenr_T)1, false);
+ ml_delete(1, false);
}
// Try reading the original file to obtain the values of 'fileformat',
// 'fileencoding', etc. Ignore errors. The text itself is not used.
if (curbuf->b_ffname != NULL) {
- orig_file_status = readfile(curbuf->b_ffname, NULL, (linenr_T)0,
- (linenr_T)0, (linenr_T)MAXLNUM, NULL, READ_NEW, false);
+ orig_file_status = readfile(curbuf->b_ffname, NULL, 0,
+ 0, MAXLNUM, NULL, READ_NEW, false);
}
// Use the 'fileformat' and 'fileencoding' as stored in the swap file.
@@ -1701,7 +1701,7 @@ void ml_sync_all(int check_file, int check_char, bool do_fsync)
}
ml_flush_line(buf); // flush buffered line
// flush locked block
- (void)ml_find_line(buf, (linenr_T)0, ML_FLUSH);
+ (void)ml_find_line(buf, 0, ML_FLUSH);
if (bufIsChanged(buf) && check_file && mf_need_trans(buf->b_ml.ml_mfp)
&& buf->b_ffname != NULL) {
// If the original file does not exist anymore or has been changed
@@ -1751,7 +1751,7 @@ void ml_preserve(buf_T *buf, int message, bool do_fsync)
got_int = false;
ml_flush_line(buf); // flush buffered line
- (void)ml_find_line(buf, (linenr_T)0, ML_FLUSH); // flush locked block
+ (void)ml_find_line(buf, 0, ML_FLUSH); // flush locked block
int status = mf_sync(mfp, MFS_ALL | (do_fsync ? MFS_FLUSH : 0));
// stack is invalid after mf_sync(.., MFS_ALL)
@@ -1778,7 +1778,7 @@ void ml_preserve(buf_T *buf, int message, bool do_fsync)
CHECK(buf->b_ml.ml_locked_low != lnum, "low != lnum");
lnum = buf->b_ml.ml_locked_high + 1;
}
- (void)ml_find_line(buf, (linenr_T)0, ML_FLUSH); // flush locked block
+ (void)ml_find_line(buf, 0, ML_FLUSH); // flush locked block
// sync the updated pointer blocks
if (mf_sync(mfp, MFS_ALL | (do_fsync ? MFS_FLUSH : 0)) == FAIL) {
status = FAIL;
@@ -2002,7 +2002,7 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, boo
// This also fills the stack with the blocks from the root to the data block
// This also releases any locked block.
bhdr_T *hp;
- if ((hp = ml_find_line(buf, lnum == 0 ? (linenr_T)1 : lnum,
+ if ((hp = ml_fin