mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #23167 from dundargoc/refactor/long
refactor: remove long
This commit is contained in:
commit
5f442e1a4a
@ -1551,7 +1551,7 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
|
|||||||
bool retval = false;
|
bool retval = false;
|
||||||
static int nesting = 0;
|
static int nesting = 0;
|
||||||
char *save_cmdarg;
|
char *save_cmdarg;
|
||||||
long save_cmdbang;
|
varnumber_T save_cmdbang;
|
||||||
static int filechangeshell_busy = false;
|
static int filechangeshell_busy = false;
|
||||||
proftime_T wait_time;
|
proftime_T wait_time;
|
||||||
bool did_save_redobuff = false;
|
bool did_save_redobuff = false;
|
||||||
|
@ -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
|
// With 32 bit longs and more than 21,474,836 lines multiplying by 100
|
||||||
// causes an overflow, thus for large numbers divide instead.
|
// causes an overflow, thus for large numbers divide instead.
|
||||||
if (curwin->w_cursor.lnum > 1000000L) {
|
if (curwin->w_cursor.lnum > 1000000) {
|
||||||
n = (int)(((long)curwin->w_cursor.lnum) /
|
n = ((curwin->w_cursor.lnum) /
|
||||||
((long)curbuf->b_ml.ml_line_count / 100L));
|
(curbuf->b_ml.ml_line_count / 100));
|
||||||
} else {
|
} else {
|
||||||
n = (int)(((long)curwin->w_cursor.lnum * 100L) /
|
n = ((curwin->w_cursor.lnum * 100) /
|
||||||
(long)curbuf->b_ml.ml_line_count);
|
curbuf->b_ml.ml_line_count);
|
||||||
}
|
}
|
||||||
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
|
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
|
||||||
vim_snprintf_add(buffer, IOSIZE, "%s", _(no_lines_msg));
|
vim_snprintf_add(buffer, IOSIZE, "%s", _(no_lines_msg));
|
||||||
|
@ -441,7 +441,7 @@ void appended_lines(linenr_T lnum, linenr_T count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Like appended_lines(), but adjust marks first.
|
/// 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);
|
mark_adjust(lnum + 1, (linenr_T)MAXLNUM, (linenr_T)count, 0L, kExtmarkUndo);
|
||||||
changed_lines(lnum + 1, 0, lnum + 1, (linenr_T)count, true);
|
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.
|
/// Like deleted_lines(), but adjust marks first.
|
||||||
/// Make sure the cursor is on a valid line before calling, a GUI callback may
|
/// Make sure the cursor is on a valid line before calling, a GUI callback may
|
||||||
/// be triggered to display the cursor.
|
/// 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;
|
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.
|
/// 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;
|
int bytes = 0;
|
||||||
char *p = get_cursor_pos_ptr();
|
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.
|
/// Saves the lines for undo first if "undo" is true.
|
||||||
void del_lines(long nlines, bool undo)
|
void del_lines(long nlines, bool undo)
|
||||||
{
|
{
|
||||||
long n;
|
int n;
|
||||||
linenr_T first = curwin->w_cursor.lnum;
|
linenr_T first = curwin->w_cursor.lnum;
|
||||||
|
|
||||||
if (nlines <= 0) {
|
if (nlines <= 0) {
|
||||||
|
@ -483,13 +483,13 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
|
|||||||
clen += 2;
|
clen += 2;
|
||||||
}
|
}
|
||||||
// jumping right, put match at the left
|
// jumping right, put match at the left
|
||||||
if ((long)clen > Columns) {
|
if (clen > Columns) {
|
||||||
first_match = match;
|
first_match = match;
|
||||||
// if showing the last match, we can add some on the left
|
// if showing the last match, we can add some on the left
|
||||||
clen = 2;
|
clen = 2;
|
||||||
for (i = match; i < num_matches; i++) {
|
for (i = match; i < num_matches; i++) {
|
||||||
clen += wildmenu_match_len(xp, SHOW_MATCH(i)) + 2;
|
clen += wildmenu_match_len(xp, SHOW_MATCH(i)) + 2;
|
||||||
if ((long)clen >= Columns) {
|
if (clen >= Columns) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -501,7 +501,7 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
|
|||||||
if (add_left) {
|
if (add_left) {
|
||||||
while (first_match > 0) {
|
while (first_match > 0) {
|
||||||
clen += wildmenu_match_len(xp, SHOW_MATCH(first_match - 1)) + 2;
|
clen += wildmenu_match_len(xp, SHOW_MATCH(first_match - 1)) + 2;
|
||||||
if ((long)clen >= Columns) {
|
if (clen >= Columns) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
first_match--;
|
first_match--;
|
||||||
|
@ -2466,8 +2466,8 @@ int diffopt_changed(void)
|
|||||||
int linematch_lines_new = 0;
|
int linematch_lines_new = 0;
|
||||||
int diff_flags_new = 0;
|
int diff_flags_new = 0;
|
||||||
int diff_foldcolumn_new = 2;
|
int diff_foldcolumn_new = 2;
|
||||||
long diff_algorithm_new = 0;
|
int diff_algorithm_new = 0;
|
||||||
long diff_indent_heuristic = 0;
|
int diff_indent_heuristic = 0;
|
||||||
|
|
||||||
char *p = p_dip;
|
char *p = p_dip;
|
||||||
while (*p != NUL) {
|
while (*p != NUL) {
|
||||||
|
@ -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)
|
static inline void get_line_number_str(win_T *wp, linenr_T lnum, char *buf, size_t buf_len)
|
||||||
{
|
{
|
||||||
long num;
|
linenr_T num;
|
||||||
char *fmt = "%*ld ";
|
char *fmt = "%*" PRIdLINENR " ";
|
||||||
|
|
||||||
if (wp->w_p_nu && !wp->w_p_rnu) {
|
if (wp->w_p_nu && !wp->w_p_rnu) {
|
||||||
// 'number' + 'norelativenumber'
|
// 'number' + 'norelativenumber'
|
||||||
num = (long)lnum;
|
num = lnum;
|
||||||
} else {
|
} else {
|
||||||
// 'relativenumber', don't use negative numbers
|
// '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) {
|
if (num == 0 && wp->w_p_nu && wp->w_p_rnu) {
|
||||||
// 'number' + 'relativenumber'
|
// 'number' + 'relativenumber'
|
||||||
num = lnum;
|
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)
|
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
|
// 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
|
// 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
|
// 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
|
winlinevars_T wlv; // variables passed between functions
|
||||||
|
|
||||||
int c = 0; // init for GCC
|
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 *line; // current line
|
||||||
char *ptr; // current position in "line"
|
char *ptr; // current position in "line"
|
||||||
ScreenGrid *grid = &wp->w_grid; // grid specific to the window
|
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;
|
nextlinecol = MAXCOL;
|
||||||
nextline_idx = 0;
|
nextline_idx = 0;
|
||||||
} else {
|
} else {
|
||||||
v = (long)strlen(line);
|
v = (ptrdiff_t)strlen(line);
|
||||||
if (v < SPWORDLEN) {
|
if (v < SPWORDLEN) {
|
||||||
// Short line, use it completely and append the start of the
|
// Short line, use it completely and append the start of the
|
||||||
// next line.
|
// 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
|
if (((dollar_vcol >= 0
|
||||||
&& wp == curwin
|
&& wp == curwin
|
||||||
&& lnum == wp->w_cursor.lnum
|
&& lnum == wp->w_cursor.lnum
|
||||||
&& wlv.vcol >= (long)wp->w_virtcol)
|
&& wlv.vcol >= wp->w_virtcol)
|
||||||
|| (number_only && wlv.draw_state > WL_STC))
|
|| (number_only && wlv.draw_state > WL_STC))
|
||||||
&& wlv.filler_todo <= 0) {
|
&& wlv.filler_todo <= 0) {
|
||||||
draw_virt_text(wp, buf, win_col_offset, &wlv.col, grid->cols, wlv.row);
|
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.
|
// 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)) {
|
if (c == TAB && (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) {
|
||||||
int tab_len = 0;
|
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);
|
char *const sbr = get_showbreak_value(wp);
|
||||||
|
|
||||||
// Only adjust the tab_len, when at the first column after the
|
// 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);
|
vcol_adjusted = wlv.vcol - mb_charlen(sbr);
|
||||||
}
|
}
|
||||||
// tab amount depends on current column
|
// 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_ts,
|
||||||
wp->w_buffer->b_p_vts_array) - 1;
|
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
|
// flag to indicate whether prevcol equals startcol of search_hl or
|
||||||
// one of the matches
|
// one of the matches
|
||||||
bool prevcol_hl_flag = get_prevcol_hl_flag(wp, &screen_search_hl,
|
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
|
// Invert at least one char, used for Visual and empty line or
|
||||||
// highlight match at end of line. If it's beyond the last
|
// 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.
|
// 'search_hl' and the match list.
|
||||||
get_search_match_hl(wp,
|
get_search_match_hl(wp,
|
||||||
&screen_search_hl,
|
&screen_search_hl,
|
||||||
(long)(ptr - line), // NOLINT(google-readability-casting)
|
(colnr_T)(ptr - line),
|
||||||
&wlv.char_attr);
|
&wlv.char_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2549,7 +2549,7 @@ int oneleft(void)
|
|||||||
|
|
||||||
/// Move the cursor up "n" lines in window "wp".
|
/// Move the cursor up "n" lines in window "wp".
|
||||||
/// Takes care of closed folds.
|
/// 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;
|
linenr_T lnum = wp->w_cursor.lnum;
|
||||||
|
|
||||||
@ -2578,14 +2578,14 @@ void cursor_up_inner(win_T *wp, long n)
|
|||||||
lnum = 1;
|
lnum = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lnum -= (linenr_T)n;
|
lnum -= n;
|
||||||
}
|
}
|
||||||
|
|
||||||
wp->w_cursor.lnum = lnum;
|
wp->w_cursor.lnum = lnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param upd_topline When true: update topline
|
/// @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.
|
// This fails if the cursor is already in the first line.
|
||||||
if (n > 0 && curwin->w_cursor.lnum <= 1) {
|
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 (!pum_visible() || curwin != old_curwin) {
|
||||||
if (dir == MSCR_DOWN || dir == MSCR_UP) {
|
if (dir == MSCR_DOWN || dir == MSCR_UP) {
|
||||||
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
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) {
|
} else if (p_mousescroll_vert > 0) {
|
||||||
scroll_redraw(dir, p_mousescroll_vert);
|
scroll_redraw(dir, (linenr_T)p_mousescroll_vert);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mouse_scroll_horiz(dir);
|
mouse_scroll_horiz(dir);
|
||||||
@ -4250,7 +4250,7 @@ static void ins_pageup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tpos = curwin->w_cursor;
|
tpos = curwin->w_cursor;
|
||||||
if (onepage(BACKWARD, 1L) == OK) {
|
if (onepage(BACKWARD, 1) == OK) {
|
||||||
start_arrow(&tpos);
|
start_arrow(&tpos);
|
||||||
can_cindent = true;
|
can_cindent = true;
|
||||||
} else {
|
} else {
|
||||||
@ -4298,7 +4298,7 @@ static void ins_pagedown(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tpos = curwin->w_cursor;
|
tpos = curwin->w_cursor;
|
||||||
if (onepage(FORWARD, 1L) == OK) {
|
if (onepage(FORWARD, 1) == OK) {
|
||||||
start_arrow(&tpos);
|
start_arrow(&tpos);
|
||||||
can_cindent = true;
|
can_cindent = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -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)
|
FUNC_ATTR_NONNULL_ARG(4, 5)
|
||||||
{
|
{
|
||||||
linenr_T lnum = lnum_arg + (append ? 1 : 0);
|
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
|
// 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
|
// 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) {
|
if (last > curbuf->b_ml.ml_line_count) {
|
||||||
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
|
// When coming here from Insert mode, sync undo, so that this can be
|
||||||
// undone separately from what was previously inserted.
|
// undone separately from what was previously inserted.
|
||||||
|
@ -886,7 +886,7 @@ static void f_copy(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
/// "count()" function
|
/// "count()" function
|
||||||
static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||||
{
|
{
|
||||||
long n = 0;
|
varnumber_T n = 0;
|
||||||
int ic = 0;
|
int ic = 0;
|
||||||
bool error = false;
|
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.
|
/// Otherwise use the column number as a byte offset.
|
||||||
static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
|
static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
|
||||||
{
|
{
|
||||||
long lnum, col;
|
linenr_T lnum;
|
||||||
long coladd = 0;
|
colnr_T col;
|
||||||
|
colnr_T coladd = 0;
|
||||||
bool set_curswant = true;
|
bool set_curswant = true;
|
||||||
|
|
||||||
rettv->vval.v_number = -1;
|
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) {
|
} else if (lnum == 0) {
|
||||||
lnum = curwin->w_cursor.lnum;
|
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) {
|
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) {
|
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 {
|
} else {
|
||||||
emsg(_(e_invarg));
|
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
|
return; // type error; errmsg already given
|
||||||
}
|
}
|
||||||
if (lnum > 0) {
|
if (lnum > 0) {
|
||||||
curwin->w_cursor.lnum = (linenr_T)lnum;
|
curwin->w_cursor.lnum = lnum;
|
||||||
}
|
}
|
||||||
if (col > 0) {
|
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.
|
// Make sure the cursor is in a valid position.
|
||||||
check_cursor();
|
check_cursor();
|
||||||
|
@ -266,7 +266,7 @@ static int get_winnr(tabpage_T *tp, typval_T *argvar)
|
|||||||
} else {
|
} else {
|
||||||
// Extract the window count (if specified). e.g. winnr('3j')
|
// Extract the window count (if specified). e.g. winnr('3j')
|
||||||
char *endp;
|
char *endp;
|
||||||
long count = strtol(arg, &endp, 10);
|
int count = (int)strtol(arg, &endp, 10);
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
// if count is not specified, default to 1
|
// if count is not specified, default to 1
|
||||||
count = 1;
|
count = 1;
|
||||||
|
@ -462,7 +462,7 @@ void ex_sort(exarg_T *eap)
|
|||||||
char *s2;
|
char *s2;
|
||||||
char c; // temporary character storage
|
char c; // temporary character storage
|
||||||
bool unique = false;
|
bool unique = false;
|
||||||
long deleted;
|
linenr_T deleted;
|
||||||
colnr_T start_col;
|
colnr_T start_col;
|
||||||
colnr_T end_col;
|
colnr_T end_col;
|
||||||
int sort_what = 0;
|
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.
|
// 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) {
|
if (deleted > 0) {
|
||||||
mark_adjust(eap->line2 - (linenr_T)deleted, eap->line2, (long)MAXLNUM, (linenr_T)(-deleted),
|
mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted, kExtmarkNOOP);
|
||||||
kExtmarkNOOP);
|
|
||||||
msgmore(-deleted);
|
msgmore(-deleted);
|
||||||
} else if (deleted < 0) {
|
} 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) {
|
if (change_occurred || deleted != 0) {
|
||||||
@ -703,7 +702,7 @@ void ex_sort(exarg_T *eap)
|
|||||||
(int)count, 0, old_count,
|
(int)count, 0, old_count,
|
||||||
lnum - eap->line2, 0, new_count, kExtmarkUndo);
|
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;
|
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
|
// 3. Substitute the string. During 'inccommand' preview only do this if
|
||||||
// there is a replace pattern.
|
// there is a replace pattern.
|
||||||
if (cmdpreview_ns <= 0 || has_second_delim) {
|
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_ma = curbuf->b_p_ma;
|
||||||
int save_sandbox = sandbox;
|
int save_sandbox = sandbox;
|
||||||
if (subflags.do_count) {
|
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,
|
extmark_splice(curbuf, (int)lnum_start - 1, start_col,
|
||||||
end.lnum - start.lnum, matchcols, replaced_bytes,
|
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.
|
// 4. If subflags.do_all is set, find next match.
|
||||||
|
@ -999,10 +999,10 @@ void *getline_cookie(LineGetter fgetline, void *cookie)
|
|||||||
/// ":bwipeout", etc.
|
/// ":bwipeout", etc.
|
||||||
///
|
///
|
||||||
/// @return the buffer number.
|
/// @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;
|
buf_T *nextbuf;
|
||||||
long count = offset;
|
int count = offset;
|
||||||
|
|
||||||
buf_T *buf = firstbuf;
|
buf_T *buf = firstbuf;
|
||||||
while (buf->b_next != NULL && buf->b_fnum < lnum) {
|
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;
|
win_T *save_curwin = curwin;
|
||||||
buf_T *save_curbuf = curbuf;
|
buf_T *save_curbuf = curbuf;
|
||||||
long topline;
|
linenr_T topline;
|
||||||
long y;
|
int y;
|
||||||
linenr_T old_linenr = curwin->w_cursor.lnum;
|
linenr_T old_linenr = curwin->w_cursor.lnum;
|
||||||
|
|
||||||
setpcmark();
|
setpcmark();
|
||||||
@ -5719,7 +5719,7 @@ static void ex_sleep(exarg_T *eap)
|
|||||||
setcursor_mayforce(true);
|
setcursor_mayforce(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
long len = eap->line2;
|
linenr_T len = eap->line2;
|
||||||
switch (*eap->arg) {
|
switch (*eap->arg) {
|
||||||
case 'm':
|
case 'm':
|
||||||
break;
|
break;
|
||||||
@ -5732,7 +5732,7 @@ static void ex_sleep(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Sleep for "msec" milliseconds, but return early on CTRL-C.
|
/// 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
|
ui_flush(); // flush before waiting
|
||||||
LOOP_PROCESS_EVENTS_UNTIL(&main_loop, main_loop.events, msec, got_int);
|
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)
|
static void ex_copymove(exarg_T *eap)
|
||||||
{
|
{
|
||||||
const char *errormsg = NULL;
|
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 (eap->arg == NULL) { // error detected
|
||||||
if (errormsg != NULL) {
|
if (errormsg != NULL) {
|
||||||
emsg(errormsg);
|
emsg(errormsg);
|
||||||
@ -5877,11 +5877,11 @@ static void ex_copymove(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_move) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ex_copy(eap->line1, eap->line2, (linenr_T)n);
|
ex_copy(eap->line1, eap->line2, n);
|
||||||
}
|
}
|
||||||
u_clearline();
|
u_clearline();
|
||||||
beginline(BL_SOL | BL_FIX);
|
beginline(BL_SOL | BL_FIX);
|
||||||
@ -5991,7 +5991,7 @@ static void ex_undo(exarg_T *eap)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long step = eap->line2;
|
linenr_T step = eap->line2;
|
||||||
|
|
||||||
if (eap->forceit) { // undo! 123
|
if (eap->forceit) { // undo! 123
|
||||||
// change number for "undo!" must be lesser than current change number
|
// change number for "undo!" must be lesser than current change number
|
||||||
@ -6579,9 +6579,9 @@ static void ex_findpat(exarg_T *eap)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
long n = 1;
|
int n = 1;
|
||||||
if (ascii_isdigit(*eap->arg)) { // get count
|
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);
|
eap->arg = skipwhite(eap->arg);
|
||||||
}
|
}
|
||||||
if (*eap->arg == '/') { // Match regexp, not just whole words
|
if (*eap->arg == '/') { // Match regexp, not just whole words
|
||||||
|
@ -30,7 +30,7 @@ typedef struct {
|
|||||||
bool save_msg_didout;
|
bool save_msg_didout;
|
||||||
int save_State;
|
int save_State;
|
||||||
bool save_finish_op;
|
bool save_finish_op;
|
||||||
long save_opcount;
|
int save_opcount;
|
||||||
int save_reg_executing;
|
int save_reg_executing;
|
||||||
bool save_pending_end_reg_executing;
|
bool save_pending_end_reg_executing;
|
||||||
tasave_T tabuf;
|
tasave_T tabuf;
|
||||||
|
@ -104,7 +104,7 @@ typedef struct {
|
|||||||
typedef struct command_line_state {
|
typedef struct command_line_state {
|
||||||
VimState state;
|
VimState state;
|
||||||
int firstc;
|
int firstc;
|
||||||
long count;
|
int count;
|
||||||
int indent;
|
int indent;
|
||||||
int c;
|
int c;
|
||||||
int gotesc; // true when <ESC> just typed
|
int gotesc; // true when <ESC> just typed
|
||||||
@ -372,7 +372,7 @@ theend:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// May do 'incsearch' highlighting if desired.
|
// 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;
|
pos_T end_pos;
|
||||||
proftime_T tm;
|
proftime_T tm;
|
||||||
@ -640,7 +640,7 @@ static void init_ccline(int firstc, int indent)
|
|||||||
/// @param count only used for incremental search
|
/// @param count only used for incremental search
|
||||||
/// @param indent indent for inside conditionals
|
/// @param indent indent for inside conditionals
|
||||||
/// @param clear_ccline clear ccline first
|
/// @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
|
// can be invoked recursively, identify each level
|
||||||
static int cmdline_level = 0;
|
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
|
// May adjust 'incsearch' highlighting for typing CTRL-G and CTRL-T, go to next
|
||||||
// or previous match.
|
// or previous match.
|
||||||
// Returns FAIL when calling command_line_not_changed.
|
// 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)
|
bool next_match)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
@ -2619,7 +2619,7 @@ static void abandon_cmdline(void)
|
|||||||
///
|
///
|
||||||
/// @param count only used for incremental search
|
/// @param count only used for incremental search
|
||||||
/// @param indent indent for inside conditionals
|
/// @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);
|
return (char *)command_line_enter(firstc, count, indent, true);
|
||||||
}
|
}
|
||||||
|
@ -638,8 +638,8 @@ EXTERN int State INIT(= MODE_NORMAL);
|
|||||||
|
|
||||||
EXTERN bool debug_mode INIT(= false);
|
EXTERN bool debug_mode INIT(= false);
|
||||||
EXTERN bool finish_op INIT(= false); // true while an operator is pending
|
EXTERN bool finish_op INIT(= false); // true while an operator is pending
|
||||||
EXTERN long opcount INIT(= 0); // count for pending operator
|
EXTERN int opcount INIT(= 0); // count for pending operator
|
||||||
EXTERN int motion_force INIT(= 0); // motion force for pending operator
|
EXTERN int motion_force INIT(= 0); // motion force for pending operator
|
||||||
|
|
||||||
// Ex Mode (Q) state
|
// Ex Mode (Q) state
|
||||||
EXTERN bool exmode_active INIT(= false); // true if Ex mode is active
|
EXTERN bool exmode_active INIT(= false); // true if Ex mode is active
|
||||||
|
@ -658,7 +658,7 @@ bool prepare_search_hl_line(win_T *wp, linenr_T lnum, colnr_T mincol, char **lin
|
|||||||
shl->endcol++;
|
shl->endcol++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((long)shl->startcol < mincol) { // match at leftcol
|
if (shl->startcol < mincol) { // match at leftcol
|
||||||
shl->attr_cur = shl->attr;
|
shl->attr_cur = shl->attr;
|
||||||
*search_attr = shl->attr;
|
*search_attr = shl->attr;
|
||||||
*search_attr_from_match = shl != search_hl;
|
*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;
|
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
|
matchitem_T *cur; // points to the match list
|
||||||
|
|
||||||
// we're not really at that column when skipping some text
|
// 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++;
|
prevcol++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Highlight a character after the end of the line if the match started
|
// 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
|
// at the end of the line or when the match continues in the next line
|
||||||
// (match includes the line break).
|
// (match includes the line break).
|
||||||
if (!search_hl->is_addpos && (prevcol == (long)search_hl->startcol
|
if (!search_hl->is_addpos && (prevcol == search_hl->startcol
|
||||||
|| (prevcol > (long)search_hl->startcol
|
|| (prevcol > search_hl->startcol
|
||||||
&& search_hl->endcol == MAXCOL))) {
|
&& search_hl->endcol == MAXCOL))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
cur = wp->w_match_head;
|
cur = wp->w_match_head;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
if (!cur->mit_hl.is_addpos && (prevcol == (long)cur->mit_hl.startcol
|
if (!cur->mit_hl.is_addpos && (prevcol == cur->mit_hl.startcol
|
||||||
|| (prevcol > (long)cur->mit_hl.startcol
|
|| (prevcol > cur->mit_hl.startcol
|
||||||
&& cur->mit_hl.endcol == MAXCOL))) {
|
&& cur->mit_hl.endcol == MAXCOL))) {
|
||||||
return true;
|
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'
|
/// Get highlighting for the char after the text in "char_attr" from 'hlsearch'
|
||||||
/// or match highlighting.
|
/// 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
|
matchitem_T *cur = wp->w_match_head; // points to the match list
|
||||||
match_T *shl; // points to search_hl or a match
|
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 {
|
} else {
|
||||||
shl = &cur->mit_hl;
|
shl = &cur->mit_hl;
|
||||||
}
|
}
|
||||||
if (col - 1 == (long)shl->startcol
|
if (col - 1 == shl->startcol
|
||||||
&& (shl == search_hl || !shl->is_addpos)) {
|
&& (shl == search_hl || !shl->is_addpos)) {
|
||||||
*char_attr = shl->attr;
|
*char_attr = shl->attr;
|
||||||
}
|
}
|
||||||
|
@ -962,14 +962,14 @@ void ml_recover(bool checkext)
|
|||||||
// Now that we are sure that the file is going to be recovered, clear the
|
// Now that we are sure that the file is going to be recovered, clear the
|
||||||
// contents of the current buffer.
|
// contents of the current buffer.
|
||||||
while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) {
|
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',
|
// Try reading the original file to obtain the values of 'fileformat',
|
||||||
// 'fileencoding', etc. Ignore errors. The text itself is not used.
|
// 'fileencoding', etc. Ignore errors. The text itself is not used.
|
||||||
if (curbuf->b_ffname != NULL) {
|
if (curbuf->b_ffname != NULL) {
|
||||||
orig_file_status = readfile(curbuf->b_ffname, NULL, (linenr_T)0,
|
orig_file_status = readfile(curbuf->b_ffname, NULL, 0,
|
||||||
(linenr_T)0, (linenr_T)MAXLNUM, NULL, READ_NEW, false);
|
0, MAXLNUM, NULL, READ_NEW, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the 'fileformat' and 'fileencoding' as stored in the swap file.
|
// 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
|
ml_flush_line(buf); // flush buffered line
|
||||||
// flush locked block
|
// 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)
|
if (bufIsChanged(buf) && check_file && mf_need_trans(buf->b_ml.ml_mfp)
|
||||||
&& buf->b_ffname != NULL) {
|
&& buf->b_ffname != NULL) {
|
||||||
// If the original file does not exist anymore or has been changed
|
// 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;
|
got_int = false;
|
||||||
|
|
||||||
ml_flush_line(buf); // flush buffered line
|
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));
|
int status = mf_sync(mfp, MFS_ALL | (do_fsync ? MFS_FLUSH : 0));
|
||||||
|
|
||||||
// stack is invalid after mf_sync(.., MFS_ALL)
|
// 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");
|
CHECK(buf->b_ml.ml_locked_low != lnum, "low != lnum");
|
||||||
lnum = buf->b_ml.ml_locked_high + 1;
|
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
|
// sync the updated pointer blocks
|
||||||
if (mf_sync(mfp, MFS_ALL | (do_fsync ? MFS_FLUSH : 0)) == FAIL) {
|
if (mf_sync(mfp, MFS_ALL | (do_fsync ? MFS_FLUSH : 0)) == FAIL) {
|
||||||
status = 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 fills the stack with the blocks from the root to the data block
|
||||||
// This also releases any locked block.
|
// This also releases any locked block.
|
||||||
bhdr_T *hp;
|
bhdr_T *hp;
|
||||||
if ((hp = ml_find_line(buf, lnum == 0 ? (linenr_T)1 : lnum,
|
if ((hp = ml_find_line(buf, lnum == 0 ? 1 : lnum,
|
||||||
ML_INSERT)) == NULL) {
|
ML_INSERT)) == NULL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -2235,7 +2235,7 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, boo
|
|||||||
// pointer blocks is done below
|
// pointer blocks is done below
|
||||||
lineadd = buf->b_ml.ml_locked_lineadd;
|
lineadd = buf->b_ml.ml_locked_lineadd;
|
||||||
buf->b_ml.ml_locked_lineadd = 0;
|
buf->b_ml.ml_locked_lineadd = 0;
|
||||||
(void)ml_find_line(buf, (linenr_T)0, ML_FLUSH); // flush data block
|
(void)ml_find_line(buf, 0, ML_FLUSH); // flush data block
|
||||||
|
|
||||||
// update pointer blocks for the new data block
|
// update pointer blocks for the new data block
|
||||||
for (stack_idx = buf->b_ml.ml_stack_top - 1; stack_idx >= 0; stack_idx--) {
|
for (stack_idx = buf->b_ml.ml_stack_top - 1; stack_idx >= 0; stack_idx--) {
|
||||||
@ -2491,7 +2491,7 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, bool message)
|
|||||||
set_keep_msg(_(no_lines_msg), 0);
|
set_keep_msg(_(no_lines_msg), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = ml_replace((linenr_T)1, "", true);
|
int i = ml_replace(1, "", true);
|
||||||
buf->b_ml.ml_flags |= ML_EMPTY;
|
buf->b_ml.ml_flags |= ML_EMPTY;
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
@ -2628,7 +2628,7 @@ void ml_setmarked(linenr_T lnum)
|
|||||||
linenr_T ml_firstmarked(void)
|
linenr_T ml_firstmarked(void)
|
||||||
{
|
{
|
||||||
if (curbuf->b_ml.ml_mfp == NULL) {
|
if (curbuf->b_ml.ml_mfp == NULL) {
|
||||||
return (linenr_T)0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The search starts with lowest_marked line. This is the last line where
|
// The search starts with lowest_marked line. This is the last line where
|
||||||
@ -2639,7 +2639,7 @@ linenr_T ml_firstmarked(void)
|
|||||||
// block This also releases any locked block.
|
// block This also releases any locked block.
|
||||||
bhdr_T *hp;
|
bhdr_T *hp;
|
||||||
if ((hp = ml_find_line(curbuf, lnum, ML_FIND)) == NULL) {
|
if ((hp = ml_find_line(curbuf, lnum, ML_FIND)) == NULL) {
|
||||||
return (linenr_T)0; // give error message?
|
return 0; // give error message?
|
||||||
}
|
}
|
||||||
DATA_BL *dp = hp->bh_data;
|
DATA_BL *dp = hp->bh_data;
|
||||||
|
|
||||||
@ -2654,7 +2654,7 @@ linenr_T ml_firstmarked(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (linenr_T)0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// clear all DB_MARKED flags
|
/// clear all DB_MARKED flags
|
||||||
@ -4021,7 +4021,7 @@ void goto_byte(long cnt)
|
|||||||
if (boff) {
|
if (boff) {
|
||||||
boff--;
|
boff--;
|
||||||
}
|
}
|
||||||
linenr_T lnum = (linenr_T)ml_find_line_or_offset(curbuf, (linenr_T)0, &boff, false);
|
linenr_T lnum = (linenr_T)ml_find_line_or_offset(curbuf, 0, &boff, false);
|
||||||
if (lnum < 1) { // past the end
|
if (lnum < 1) { // past the end
|
||||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||||
curwin->w_curswant = MAXCOL;
|
curwin->w_curswant = MAXCOL;
|
||||||
|
@ -284,7 +284,7 @@ static int get_fpos_of_mouse(pos_T *mpos)
|
|||||||
/// @param fixindent PUT_FIXINDENT if fixing indent necessary
|
/// @param fixindent PUT_FIXINDENT if fixing indent necessary
|
||||||
///
|
///
|
||||||
/// @return true if start_arrow() should be called for edit mode.
|
/// @return true if start_arrow() should be called for edit mode.
|
||||||
bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
|
bool do_mouse(oparg_T *oap, int c, int dir, int count, bool fixindent)
|
||||||
{
|
{
|
||||||
static bool got_click = false; // got a click some time back
|
static bool got_click = false; // got a click some time back
|
||||||
|
|
||||||
@ -732,7 +732,7 @@ popupexit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start_visual.lnum) { // right click in visual mode
|
if (start_visual.lnum) { // right click in visual mode
|
||||||
long diff;
|
linenr_T diff;
|
||||||
// When ALT is pressed make Visual mode blockwise.
|
// When ALT is pressed make Visual mode blockwise.
|
||||||
if (mod_mask & MOD_MASK_ALT) {
|
if (mod_mask & MOD_MASK_ALT) {
|
||||||
VIsual_mode = Ctrl_V;
|
VIsual_mode = Ctrl_V;
|
||||||
@ -1616,17 +1616,17 @@ static linenr_T find_longest_lnum(void)
|
|||||||
if (curwin->w_topline <= curwin->w_cursor.lnum
|
if (curwin->w_topline <= curwin->w_cursor.lnum
|
||||||
&& curwin->w_botline > curwin->w_cursor.lnum
|
&& curwin->w_botline > curwin->w_cursor.lnum
|
||||||
&& curwin->w_botline <= curbuf->b_ml.ml_line_count + 1) {
|
&& curwin->w_botline <= curbuf->b_ml.ml_line_count + 1) {
|
||||||
long max = 0;
|
colnr_T max = 0;
|
||||||
|
|
||||||
// Use maximum of all visible lines. Remember the lnum of the
|
// Use maximum of all visible lines. Remember the lnum of the
|
||||||
// longest line, closest to the cursor line. Used when scrolling
|
// longest line, closest to the cursor line. Used when scrolling
|
||||||
// below.
|
// below.
|
||||||
for (linenr_T lnum = curwin->w_topline; lnum < curwin->w_botline; lnum++) {
|
for (linenr_T lnum = curwin->w_topline; lnum < curwin->w_botline; lnum++) {
|
||||||
colnr_T len = scroll_line_len(lnum);
|
colnr_T len = scroll_line_len(lnum);
|
||||||
if (len > (colnr_T)max) {
|
if (len > max) {
|
||||||
max = len;
|
max = len;
|
||||||
ret = lnum;
|
ret = lnum;
|
||||||
} else if (len == (colnr_T)max
|
} else if (len == max
|
||||||
&& abs(lnum - curwin->w_cursor.lnum)
|
&& abs(lnum - curwin->w_cursor.lnum)
|
||||||
< abs(ret - curwin->w_cursor.lnum)) {
|
< abs(ret - curwin->w_cursor.lnum)) {
|
||||||
ret = lnum;
|
ret = lnum;
|
||||||
|
@ -1334,7 +1334,7 @@ bool scrolldown(long line_count, int byfold)
|
|||||||
///
|
///
|
||||||
/// @param line_count number of lines to scroll
|
/// @param line_count number of lines to scroll
|
||||||
/// @param byfold if true, count a closed fold as one line
|
/// @param byfold if true, count a closed fold as one line
|
||||||
bool scrollup(long line_count, int byfold)
|
bool scrollup(linenr_T line_count, int byfold)
|
||||||
{
|
{
|
||||||
linenr_T topline = curwin->w_topline;
|
linenr_T topline = curwin->w_topline;
|
||||||
linenr_T botline = curwin->w_botline;
|
linenr_T botline = curwin->w_botline;
|
||||||
@ -1402,8 +1402,8 @@ bool scrollup(long line_count, int byfold)
|
|||||||
redraw_later(curwin, UPD_NOT_VALID);
|
redraw_later(curwin, UPD_NOT_VALID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
curwin->w_topline += (linenr_T)line_count;
|
curwin->w_topline += line_count;
|
||||||
curwin->w_botline += (linenr_T)line_count; // approximate w_botline
|
curwin->w_botline += line_count; // approximate w_botline
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curwin->w_topline > curbuf->b_ml.ml_line_count) {
|
if (curwin->w_topline > curbuf->b_ml.ml_line_count) {
|
||||||
|
@ -1406,7 +1406,7 @@ static int normal_check(VimState *state)
|
|||||||
// Scroll-binding for diff mode may have been postponed until
|
// Scroll-binding for diff mode may have been postponed until
|
||||||
// here. Avoids doing it for every change.
|
// here. Avoids doing it for every change.
|
||||||
if (diff_need_scrollbind) {
|
if (diff_need_scrollbind) {
|
||||||
check_scrollbind((linenr_T)0, 0L);
|
check_scrollbind(0, 0L);
|
||||||
diff_need_scrollbind = false;
|
diff_need_scrollbind = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2116,8 +2116,8 @@ void check_scrollbind(linenr_T topline_diff, long leftcol_diff)
|
|||||||
int old_VIsual_select = VIsual_select;
|
int old_VIsual_select = VIsual_select;
|
||||||
int old_VIsual_active = VIsual_active;
|
int old_VIsual_active = VIsual_active;
|
||||||
colnr_T tgt_leftcol = curwin->w_leftcol;
|
colnr_T tgt_leftcol = curwin->w_leftcol;
|
||||||
long topline;
|
linenr_T topline;
|
||||||
long y;
|
linenr_T y;
|
||||||
|
|
||||||
// check 'scrollopt' string for vertical and horizontal scroll options
|
// check 'scrollopt' string for vertical and horizontal scroll options
|
||||||
want_ver = (vim_strchr(p_sbo, 'v') && topline_diff != 0);
|
want_ver = (vim_strchr(p_sbo, 'v') && topline_diff != 0);
|
||||||
@ -2140,7 +2140,7 @@ void check_scrollbind(linenr_T topline_diff, long leftcol_diff)
|
|||||||
diff_set_topline(old_curwin, curwin);
|
diff_set_topline(old_curwin, curwin);
|
||||||
} else {
|
} else {
|
||||||
curwin->w_scbind_pos += topline_diff;
|
curwin->w_scbind_pos += topline_diff;
|
||||||
topline = curwin->w_scbind_pos;
|
topline = (linenr_T)curwin->w_scbind_pos;
|
||||||
if (topline > curbuf->b_ml.ml_line_count) {
|
if (topline > curbuf->b_ml.ml_line_count) {
|
||||||
topline = curbuf->b_ml.ml_line_count;
|
topline = curbuf->b_ml.ml_line_count;
|
||||||
}
|
}
|
||||||
@ -2210,7 +2210,7 @@ static void nv_addsub(cmdarg_T *cap)
|
|||||||
} else if (!VIsual_active && cap->oap->op_type == OP_NOP) {
|
} else if (!VIsual_active && cap->oap->op_type == OP_NOP) {
|
||||||
prep_redo_cmd(cap);
|
prep_redo_cmd(cap);
|
||||||
cap->oap->op_type = cap->cmdchar == Ctrl_A ? OP_NR_ADD : OP_NR_SUB;
|
cap->oap->op_type = cap->cmdchar == Ctrl_A ? OP_NR_ADD : OP_NR_SUB;
|
||||||
op_addsub(cap->oap, (linenr_T)cap->count1, cap->arg);
|
op_addsub(cap->oap, cap->count1, cap->arg);
|
||||||
cap->oap->op_type = OP_NOP;
|
cap->oap->op_type = OP_NOP;
|
||||||
} else if (VIsual_active) {
|
} else if (VIsual_active) {
|
||||||
nv_operator(cap);
|
nv_operator(cap);
|
||||||
@ -2229,9 +2229,9 @@ static void nv_page(cmdarg_T *cap)
|
|||||||
if (mod_mask & MOD_MASK_CTRL) {
|
if (mod_mask & MOD_MASK_CTRL) {
|
||||||
// <C-PageUp>: tab page back; <C-PageDown>: tab page forward
|
// <C-PageUp>: tab page back; <C-PageDown>: tab page forward
|
||||||
if (cap->arg == BACKWARD) {
|
if (cap->arg == BACKWARD) {
|
||||||
goto_tabpage(-(int)cap->count1);
|
goto_tabpage(-cap->count1);
|
||||||
} else {
|
} else {
|
||||||
goto_tabpage((int)cap->count0);
|
goto_tabpage(cap->count0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(void)onepage(cap->arg, cap->count1);
|
(void)onepage(cap->arg, cap->count1);
|
||||||
@ -2604,10 +2604,10 @@ static void nv_mousescroll(cmdarg_T *cap)
|
|||||||
|
|
||||||
if (cap->arg == MSCR_UP || cap->arg == MSCR_DOWN) {
|
if (cap->arg == MSCR_UP || cap->arg == MSCR_DOWN) {
|
||||||
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
||||||
(void)onepage(cap->arg ? FORWARD : BACKWARD, 1L);
|
(void)onepage(cap->arg ? FORWARD : BACKWARD, 1);
|
||||||
} else if (p_mousescroll_vert > 0) {
|
} else if (p_mousescroll_vert > 0) {
|
||||||
cap->count1 = p_mousescroll_vert;
|
cap->count1 = (int)p_mousescroll_vert;
|
||||||
cap->count0 = p_mousescroll_vert;
|
cap->count0 = (int)p_mousescroll_vert;
|
||||||
nv_scroll_line(cap);
|
nv_scroll_line(cap);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2639,7 +2639,7 @@ static void nv_scroll_line(cmdarg_T *cap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Scroll "count" lines up or down, and redraw.
|
/// Scroll "count" lines up or down, and redraw.
|
||||||
void scroll_redraw(int up, long count)
|
void scroll_redraw(int up, linenr_T count)
|
||||||
{
|
{
|
||||||
linenr_T prev_topline = curwin->w_topline;
|
linenr_T prev_topline = curwin->w_topline;
|
||||||
int prev_skipcol = curwin->w_skipcol;
|
int prev_skipcol = curwin->w_skipcol;
|
||||||
@ -2701,7 +2701,7 @@ static bool nv_z_get_count(cmdarg_T *cap, int *nchar_arg)
|
|||||||
if (checkclearop(cap->oap)) {
|
if (checkclearop(cap->oap)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
long n = nchar - '0';
|
int n = nchar - '0';
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
no_mapping++;
|
no_mapping++;
|
||||||
@ -2717,7 +2717,7 @@ static bool nv_z_get_count(cmdarg_T *cap, int *nchar_arg)
|
|||||||
} else if (ascii_isdigit(nchar)) {
|
} else if (ascii_isdigit(nchar)) {
|
||||||
n = n * 10 + (nchar - '0');
|
n = n * 10 + (nchar - '0');
|
||||||
} else if (nchar == CAR) {
|
} else if (nchar == CAR) {
|
||||||
win_setheight((int)n);
|
win_setheight(n);
|
||||||
break;
|
break;
|
||||||
} else if (nchar == 'l'
|
} else if (nchar == 'l'
|
||||||
|| nchar == 'h'
|
|| nchar == 'h'
|
||||||
@ -2789,7 +2789,7 @@ static int nv_zg_zw(cmdarg_T *cap, int nchar)
|
|||||||
assert(len <= INT_MAX);
|
assert(len <= INT_MAX);
|
||||||
spell_add_word(ptr, (int)len,
|
spell_add_word(ptr, (int)len,
|
||||||
nchar == 'w' || nchar == 'W' ? SPELL_ADD_BAD : SPELL_ADD_GOOD,
|
nchar == 'w' || nchar == 'W' ? SPELL_ADD_BAD : SPELL_ADD_GOOD,
|
||||||
(nchar == 'G' || nchar == 'W') ? 0 : (int)cap->count1,
|
(nchar == 'G' || nchar == 'W') ? 0 : cap->count1,
|
||||||
undo);
|
undo);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@ -2828,7 +2828,7 @@ static void nv_zet(cmdarg_T *cap)
|
|||||||
if (cap->count0 > curbuf->b_ml.ml_line_count) {
|
if (cap->count0 > curbuf->b_ml.ml_line_count) {
|
||||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||||
} else {
|
} else {
|
||||||
curwin->w_cursor.lnum = (linenr_T)cap->count0;
|
curwin->w_cursor.lnum = cap->count0;
|
||||||
}
|
}
|
||||||
check_cursor_col();
|
check_cursor_col();
|
||||||
}
|
}
|
||||||
@ -3009,7 +3009,7 @@ static void nv_zet(cmdarg_T *cap)
|
|||||||
clearFolding(curwin);
|
clearFolding(curwin);
|
||||||
changed_window_setting();
|
changed_window_setting();
|
||||||
} else if (foldmethodIsMarker(curwin)) {
|
} else if (foldmethodIsMarker(curwin)) {
|
||||||
deleteFold(curwin, (linenr_T)1, curbuf->b_ml.ml_line_count, true, false);
|
deleteFold(curwin, 1, curbuf->b_ml.ml_line_count, true, false);
|
||||||
} else {
|
} else {
|
||||||
emsg(_("E352: Cannot erase folds with current 'foldmethod'"));
|
emsg(_("E352: Cannot erase folds with current 'foldmethod'"));
|
||||||
}
|
}
|
||||||
@ -3163,7 +3163,7 @@ static void nv_zet(cmdarg_T *cap)
|
|||||||
|
|
||||||
case '=': // "z=": suggestions for a badly spelled word
|
case '=': // "z=": suggestions for a badly spelled word
|
||||||
if (!checkclearop(cap->oap)) {
|
if (!checkclearop(cap->oap)) {
|
||||||
spell_suggest((int)cap->count0);
|
spell_suggest(cap->count0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3267,7 +3267,7 @@ static void nv_ctrlg(cmdarg_T *cap)
|
|||||||
showmode();
|
showmode();
|
||||||
} else if (!checkclearop(cap->oap)) {
|
} else if (!checkclearop(cap->oap)) {
|
||||||
// print full name if count given or :cd used
|
// print full name if count given or :cd used
|
||||||
fileinfo((int)cap->count0, false, true);
|
fileinfo(cap->count0, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3317,7 +3317,7 @@ static void nv_ctrlo(cmdarg_T *cap)
|
|||||||
static void nv_hat(cmdarg_T *cap)
|
static void nv_hat(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
if (!checkclearopq(cap->oap)) {
|
if (!checkclearopq(cap->oap)) {
|
||||||
(void)buflist_getfile((int)cap->count0, (linenr_T)0,
|
(void)buflist_getfile(cap->count0, 0,
|
||||||
GETF_SETMARK|GETF_ALT, false);
|
GETF_SETMARK|GETF_ALT, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3644,14 +3644,14 @@ bool get_visual_text(cmdarg_T *cap, char **pp, size_t *lenp)
|
|||||||
static void nv_tagpop(cmdarg_T *cap)
|
static void nv_tagpop(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
if (!checkclearopq(cap->oap)) {
|
if (!checkclearopq(cap->oap)) {
|
||||||
do_tag("", DT_POP, (int)cap->count1, false, true);
|
do_tag("", DT_POP, cap->count1, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle scrolling command 'H', 'L' and 'M'.
|
/// Handle scrolling command 'H', 'L' and 'M'.
|
||||||
static void nv_scroll(cmdarg_T *cap)
|
static void nv_scroll(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
long n;
|
int n;
|
||||||
linenr_T lnum;
|
linenr_T lnum;
|
||||||
|
|
||||||
cap->oap->motion_type = kMTLineWise;
|
cap->oap->motion_type = kMTLineWise;
|
||||||
@ -3674,7 +3674,7 @@ static void nv_scroll(cmdarg_T *cap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
curwin->w_cursor.lnum -= (linenr_T)cap->count1 - 1;
|
curwin->w_cursor.lnum -= cap->count1 - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3688,15 +3688,15 @@ static void nv_scroll(cmdarg_T *cap)
|
|||||||
for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; n++) {
|
for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; n++) {
|
||||||
// Count half the number of filler lines to be "below this
|
// Count half the number of filler lines to be "below this
|
||||||
// line" and half to be "above the next line".
|
// line" and half to be "above the next line".
|
||||||
if (n > 0 && used + win_get_fill(curwin, curwin->w_topline + (linenr_T)n) / 2 >= half) {
|
if (n > 0 && used + win_get_fill(curwin, curwin->w_topline + n) / 2 >= half) {
|
||||||
n--;
|
n--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
used += plines_win(curwin, curwin->w_topline + (linenr_T)n, true);
|
used += plines_win(curwin, curwin->w_topline + n, true);
|
||||||
if (used >= half) {
|
if (used >= half) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (hasFolding(curwin->w_topline + (linenr_T)n, NULL, &lnum)) {
|
if (hasFolding(curwin->w_topline + n, NULL, &lnum)) {
|
||||||
n = lnum - curwin->w_topline;
|
n = lnum - curwin->w_topline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3715,7 +3715,7 @@ static void nv_scroll(cmdarg_T *cap)
|
|||||||
n = lnum - curwin->w_topline;
|
n = lnum - curwin->w_topline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
curwin->w_cursor.lnum = curwin->w_topline + (linenr_T)n;
|
curwin->w_cursor.lnum = curwin->w_topline + n;
|
||||||
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
|
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
|
||||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||||
}
|
}
|
||||||
@ -3731,7 +3731,7 @@ static void nv_scroll(cmdarg_T *cap)
|
|||||||
/// Cursor right commands.
|
/// Cursor right commands.
|
||||||
static void nv_right(cmdarg_T *cap)
|
static void nv_right(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
long n;
|
int n;
|
||||||
|
|
||||||
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
||||||
// <C-Right> and <S-Right> move a word or WORD right
|
// <C-Right> and <S-Right> move a word or WORD right
|
||||||
@ -3809,7 +3809,7 @@ static void nv_right(cmdarg_T *cap)
|
|||||||
/// @return true when operator end should not be adjusted.
|
/// @return true when operator end should not be adjusted.
|
||||||
static void nv_left(cmdarg_T *cap)
|
static void nv_left(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
long n;
|
int n;
|
||||||
|
|
||||||
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
||||||
// <C-Left> and <S-Left> move a word or WORD left
|
// <C-Left> and <S-Left> move a word or WORD left
|
||||||
@ -4110,7 +4110,7 @@ static void nv_bracket_block(cmdarg_T *cap, const pos_T *old_pos)
|
|||||||
pos_T new_pos = { 0, 0, 0 };
|
pos_T new_pos = { 0, 0, 0 };
|
||||||
pos_T *pos = NULL; // init for GCC
|
pos_T *pos = NULL; // init for GCC
|
||||||
pos_T prev_pos;
|
pos_T prev_pos;
|
||||||
long n;
|
int n;
|
||||||
int findc;
|
int findc;
|
||||||
|
|
||||||
if (cap->nchar == '*') {
|
if (cap->nchar == '*') {
|
||||||
@ -4224,7 +4224,7 @@ static void nv_brackets(cmdarg_T *cap)
|
|||||||
{
|
{
|
||||||
pos_T old_pos; // cursor position before command
|
pos_T old_pos; // cursor position before command
|
||||||
int flag;
|
int flag;
|
||||||
long n;
|
int n;
|
||||||
|
|
||||||
cap->oap->motion_type = kMTCharWise;
|
cap->oap->motion_type = kMTCharWise;
|
||||||
cap->oap->inclusive = false;
|
cap->oap->inclusive = false;
|
||||||
@ -4261,7 +4261,7 @@ static void nv_brackets(cmdarg_T *cap)
|
|||||||
ACTION_GOTO),
|
ACTION_GOTO),
|
||||||
(cap->cmdchar == ']'
|
(cap->cmdchar == ']'
|
||||||
? curwin->w_cursor.lnum + 1
|
? curwin->w_cursor.lnum + 1
|
||||||
: (linenr_T)1),
|
: 1),
|
||||||
MAXLNUM);
|
MAXLNUM);
|
||||||
xfree(ptr);
|
xfree(ptr);
|
||||||
curwin->w_set_curswant = true;
|
curwin->w_set_curswant = true;
|
||||||
@ -4373,10 +4373,10 @@ static void nv_percent(cmdarg_T *cap)
|
|||||||
// to avoid overflows.
|
// to avoid overflows.
|
||||||
if (curbuf->b_ml.ml_line_count >= 21474836) {
|
if (curbuf->b_ml.ml_line_count >= 21474836) {
|
||||||
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99)
|
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99)
|
||||||
/ 100 * (linenr_T)cap->count0;
|
/ 100 * cap->count0;
|
||||||
} else {
|
} else {
|
||||||
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count *
|
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count *
|
||||||
(linenr_T)cap->count0 + 99) / 100;
|
cap->count0 + 99) / 100;
|
||||||
}
|
}
|
||||||
if (curwin->w_cursor.lnum < 1) {
|
if (curwin->w_cursor.lnum < 1) {
|
||||||
curwin->w_cursor.lnum = 1;
|
curwin->w_cursor.lnum = 1;
|
||||||
@ -4487,7 +4487,7 @@ static void nv_kundo(cmdarg_T *cap)
|
|||||||
clearopbeep(cap->oap);
|
clearopbeep(cap->oap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
u_undo((int)cap->count1);
|
u_undo(cap->count1);
|
||||||
curwin->w_set_curswant = true;
|
curwin->w_set_curswant = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4611,7 +4611,7 @@ static void nv_replace(cmdarg_T *cap)
|
|||||||
// This is slow, but it handles replacing a single-byte with a
|
// This is slow, but it handles replacing a single-byte with a
|
||||||
// multi-byte and the other way around. Also handles adding
|
// multi-byte and the other way around. Also handles adding
|
||||||
// composing characters for utf-8.
|
// composing characters for utf-8.
|
||||||
for (long n = cap->count1; n > 0; n--) {
|
for (int n = cap->count1; n > 0; n--) {
|
||||||
State = MODE_REPLACE;
|
State = MODE_REPLACE;
|
||||||
if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y) {
|
if (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y) {
|
||||||
int c = ins_copychar(curwin->w_cursor.lnum
|
int c = ins_copychar(curwin->w_cursor.lnum
|
||||||
@ -4753,7 +4753,7 @@ static void nv_vreplace(cmdarg_T *cap)
|
|||||||
/// Swap case for "~" command, when it does not work like an operator.
|
/// Swap case for "~" command, when it does not work like an operator.
|
||||||
static void n_swapchar(cmdarg_T *cap)
|
static void n_swapchar(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
long n;
|
int n;
|
||||||
pos_T startpos;
|
pos_T startpos;
|
||||||
int did_change = 0;
|
int did_change = 0;
|
||||||
|
|
||||||
@ -4959,9 +4959,9 @@ static void nv_pcmark(cmdarg_T *cap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cap->cmdchar == 'g') {
|
if (cap->cmdchar == 'g') {
|
||||||
fm = get_changelist(curbuf, curwin, (int)cap->count1);
|
fm = get_changelist(curbuf, curwin, cap->count1);
|
||||||
} else {
|
} else {
|
||||||
fm = get_jumplist(curwin, (int)cap->count1);
|
fm = get_jumplist(curwin, cap->count1);
|
||||||
flags |= KMarkNoContext | kMarkJumpList;
|
flags |= KMarkNoContext | kMarkJumpList;
|
||||||
}
|
}
|
||||||
// Changelist and jumplist have their own error messages. Therefore avoid
|
// Changelist and jumplist have their own error messages. Therefore avoid
|
||||||
@ -5053,7 +5053,7 @@ static void nv_visual(cmdarg_T *cap)
|
|||||||
// For V and ^V, we multiply the number of lines even if there
|
// For V and ^V, we multiply the number of lines even if there
|
||||||
// was only one -- webb
|
// was only one -- webb
|
||||||
if (resel_VIsual_mode != 'v' || resel_VIsual_line_count > 1) {
|
if (resel_VIsual_mode != 'v' || resel_VIsual_line_count > 1) {
|
||||||
curwin->w_cursor.lnum += resel_VIsual_line_count * (linenr_T)cap->count0 - 1;
|
curwin->w_cursor.lnum += resel_VIsual_line_count * cap->count0 - 1;
|
||||||
check_cursor();
|
check_cursor();
|
||||||
}
|
}
|
||||||
VIsual_mode = resel_VIsual_mode;
|
VIsual_mode = resel_VIsual_mode;
|
||||||
@ -5061,7 +5061,7 @@ static void nv_visual(cmdarg_T *cap)
|
|||||||
if (resel_VIsual_line_count <= 1) {
|
if (resel_VIsual_line_count <= 1) {
|
||||||
update_curswant_force();
|
update_curswant_force();
|
||||||
assert(cap->count0 >= INT_MIN && cap->count0 <= INT_MAX);
|
assert(cap->count0 >= INT_MIN && cap->count0 <= INT_MAX);
|
||||||
curwin->w_curswant += resel_VIsual_vcol * (int)cap->count0;
|
curwin->w_curswant += resel_VIsual_vcol * cap->count0;
|
||||||
if (*p_sel != 'e') {
|
if (*p_sel != 'e') {
|
||||||
curwin->w_curswant--;
|
curwin->w_curswant--;
|
||||||
}
|
}
|
||||||
@ -5079,7 +5079,7 @@ static void nv_visual(cmdarg_T *cap)
|
|||||||
curwin->w_cursor.lnum = VIsual.lnum;
|
curwin->w_cursor.lnum = VIsual.lnum;
|
||||||
update_curswant_force();
|
update_curswant_force();
|
||||||
assert(cap->count0 >= INT_MIN && cap->count0 <= INT_MAX);
|
assert(cap->count0 >= INT_MIN && cap->count0 <= INT_MAX);
|
||||||
curwin->w_curswant += resel_VIsual_vcol * (int)cap->count0 - 1;
|
curwin->w_curswant += resel_VIsual_vcol * cap->count0 - 1;
|
||||||
curwin->w_cursor.lnum = lnum;
|
curwin->w_cursor.lnum = lnum;
|
||||||
coladvance(curwin->w_curswant);
|
coladvance(curwin->w_curswant);
|
||||||
} else {
|
} else {
|
||||||
@ -5632,7 +5632,7 @@ static void nv_g_cmd(cmdarg_T *cap)
|
|||||||
// "gD": idem, but in the current file.
|
// "gD": idem, but in the current file.
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'D':
|
case 'D':
|
||||||
nv_gd(oap, cap->nchar, (int)cap->count0);
|
nv_gd(oap, cap->nchar, cap->count0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// g<*Mouse> : <C-*mouse>
|
// g<*Mouse> : <C-*mouse>
|
||||||
@ -5688,12 +5688,12 @@ static void nv_g_cmd(cmdarg_T *cap)
|
|||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
if (!checkclearop(oap)) {
|
if (!checkclearop(oap)) {
|
||||||
goto_tabpage((int)cap->count0);
|
goto_tabpage(cap->count0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
if (!checkclearop(oap)) {
|
if (!checkclearop(oap)) {
|
||||||
goto_tabpage(-(int)cap->count1);
|
goto_tabpage(-cap->count1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5733,10 +5733,8 @@ static void n_opencmd(cmdarg_T *cap)
|
|||||||
(void)hasFolding(curwin->w_cursor.lnum,
|
(void)hasFolding(curwin->w_cursor.lnum,
|
||||||
NULL, &curwin->w_cursor.lnum);
|
NULL, &curwin->w_cursor.lnum);
|
||||||
}
|
}
|
||||||
if (u_save((linenr_T)(curwin->w_cursor.lnum -
|
if (u_save(curwin->w_cursor.lnum - (cap->cmdchar == 'O' ? 1 : 0),
|
||||||
(cap->cmdchar == 'O' ? 1 : 0)),
|
curwin->w_cursor.lnum + (cap->cmdchar == 'o' ? 1 : 0))
|
||||||
(linenr_T)(curwin->w_cursor.lnum +
|
|
||||||
(cap->cmdchar == 'o' ? 1 : 0)))
|
|
||||||
&& open_line(cap->cmdchar == 'O' ? BACKWARD : FORWARD,
|
&& open_line(cap->cmdchar == 'O' ? BACKWARD : FORWARD,
|
||||||
has_format_option(FO_OPEN_COMS) ? OPENLINE_DO_COM : 0,
|
has_format_option(FO_OPEN_COMS) ? OPENLINE_DO_COM : 0,
|
||||||
0, NULL)) {
|
0, NULL)) {
|
||||||
@ -5787,7 +5785,7 @@ static void nv_redo_or_register(cmdarg_T *cap)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
u_redo((int)cap->count1);
|
u_redo(cap->count1);
|
||||||
curwin->w_set_curswant = true;
|
curwin->w_set_curswant = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6099,7 +6097,7 @@ static void nv_goto(cmdarg_T *cap)
|
|||||||
|
|
||||||
// When a count is given, use it instead of the default lnum
|
// When a count is given, use it instead of the default lnum
|
||||||
if (cap->count0 != 0) {
|
if (cap->count0 != 0) {
|
||||||
lnum = (linenr_T)cap->count0;
|
lnum = cap->count0;
|
||||||
}
|
}
|
||||||
if (lnum < 1L) {
|
if (lnum < 1L) {
|
||||||
lnum = 1L;
|
lnum = 1L;
|
||||||
@ -6421,7 +6419,7 @@ static void nv_halfpage(cmdarg_T *cap)
|
|||||||
&& curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count)) {
|
&& curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count)) {
|
||||||
clearopbeep(cap->oap);
|
clearopbeep(cap->oap);
|
||||||
} else if (!checkclearop(cap->oap)) {
|
} else if (!checkclearop(cap->oap)) {
|
||||||
halfpage(cap->cmdchar == Ctrl_D, (linenr_T)cap->count0);
|
halfpage(cap->cmdchar == Ctrl_D, cap->count0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ typedef struct oparg_S {
|
|||||||
bool is_VIsual; // operator on Visual area
|
bool is_VIsual; // operator on Visual area
|
||||||
colnr_T start_vcol; // start col for block mode operator
|
colnr_T start_vcol; // start col for block mode operator
|
||||||
colnr_T end_vcol; // end col for block mode operator
|
colnr_T end_vcol; // end col for block mode operator
|
||||||
long prev_opcount; // ca.opcount saved for K_EVENT
|
int prev_opcount; // ca.opcount saved for K_EVENT
|
||||||
long prev_count0; // ca.count0 saved for K_EVENT
|
int prev_count0; // ca.count0 saved for K_EVENT
|
||||||
bool excl_tr_ws; // exclude trailing whitespace for yank of a
|
bool excl_tr_ws; // exclude trailing whitespace for yank of a
|
||||||
// block
|
// block
|
||||||
} oparg_T;
|
} oparg_T;
|
||||||
@ -61,9 +61,9 @@ typedef struct cmdarg_S {
|
|||||||
int ncharC1; // first composing character (optional)
|
int ncharC1; // first composing character (optional)
|
||||||
int ncharC2; // second composing character (optional)
|
int ncharC2; // second composing character (optional)
|
||||||
int extra_char; // yet another character (optional)
|
int extra_char; // yet another character (optional)
|
||||||
long opcount; // count before an operator
|
int opcount; // count before an operator
|
||||||
long count0; // count before command, default 0
|
int count0; // count before command, default 0
|
||||||
long count1; // count before command, default 1
|
int count1; // count before command, default 1
|
||||||
int arg; // extra argument from nv_cmds[]
|
int arg; // extra argument from nv_cmds[]
|
||||||
int retval; // return: CA_* values
|
int retval; // return: CA_* values
|
||||||
char *searchbuf; // return: pointer to search pattern or NULL
|
char *searchbuf; // return: pointer to search pattern or NULL
|
||||||
|
@ -5763,7 +5763,7 @@ typedef struct {
|
|||||||
int rv_mode; ///< 'v', 'V', or Ctrl-V
|
int rv_mode; ///< 'v', 'V', or Ctrl-V
|
||||||
linenr_T rv_line_count; ///< number of lines
|
linenr_T rv_line_count; ///< number of lines
|
||||||
colnr_T rv_vcol; ///< number of cols or end column
|
colnr_T rv_vcol; ///< number of cols or end column
|
||||||
long rv_count; ///< count for Visual operator
|
int rv_count; ///< count for Visual operator
|
||||||
int rv_arg; ///< extra argument
|
int rv_arg; ///< extra argument
|
||||||
} redo_VIsual_T;
|
} redo_VIsual_T;
|
||||||
|
|
||||||
@ -6157,7 +6157,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
|||||||
switch (oap->op_type) {
|
switch (oap->op_type) {
|
||||||
case OP_LSHIFT:
|
case OP_LSHIFT:
|
||||||
case OP_RSHIFT:
|
case OP_RSHIFT:
|
||||||
op_shift(oap, true, oap->is_VIsual ? (int)cap->count1 : 1);
|
op_shift(oap, true, oap->is_VIsual ? cap->count1 : 1);
|
||||||
auto_format(false, true);
|
auto_format(false, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -6198,13 +6198,13 @@ dict_T *get_winbuf_options(const int bufopt)
|
|||||||
|
|
||||||
/// Return the effective 'scrolloff' value for the current window, using the
|
/// Return the effective 'scrolloff' value for the current window, using the
|
||||||
/// global value when appropriate.
|
/// global value when appropriate.
|
||||||
long get_scrolloff_value(win_T *wp)
|
linenr_T get_scrolloff_value(win_T *wp)
|
||||||
{
|
{
|
||||||
// Disallow scrolloff in terminal-mode. #11915
|
// Disallow scrolloff in terminal-mode. #11915
|
||||||
if (State & MODE_TERMINAL) {
|
if (State & MODE_TERMINAL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return wp->w_p_so < 0 ? p_so : wp->w_p_so;
|
return wp->w_p_so < 0 ? (linenr_T)p_so : (linenr_T)wp->w_p_so;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the effective 'sidescrolloff' value for the current window, using the
|
/// Return the effective 'sidescrolloff' value for the current window, using the
|
||||||
|
@ -549,7 +549,7 @@ void last_pat_prog(regmmatch_T *regmatch)
|
|||||||
/// the index of the first matching
|
/// the index of the first matching
|
||||||
/// subpattern plus one; one if there was none.
|
/// subpattern plus one; one if there was none.
|
||||||
int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir, char *pat,
|
int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir, char *pat,
|
||||||
long count, int options, int pat_use, searchit_arg_T *extra_arg)
|
int count, int options, int pat_use, searchit_arg_T *extra_arg)
|
||||||
{
|
{
|
||||||
int found;
|
int found;
|
||||||
linenr_T lnum; // no init to shut up Apollo cc
|
linenr_T lnum; // no init to shut up Apollo cc
|
||||||
@ -1024,7 +1024,7 @@ static int first_submatch(regmmatch_T *rp)
|
|||||||
/// @param sia optional arguments or NULL
|
/// @param sia optional arguments or NULL
|
||||||
///
|
///
|
||||||
/// @return 0 for failure, 1 for found, 2 for found and line offset added.
|
/// @return 0 for failure, 1 for found, 2 for found and line offset added.
|
||||||
int do_search(oparg_T *oap, int dirc, int search_delim, char *pat, long count, int options,
|
int do_search(oparg_T *oap, int dirc, int search_delim, char *pat, int count, int options,
|
||||||
searchit_arg_T *sia)
|
searchit_arg_T *sia)
|
||||||
{
|
{
|
||||||
pos_T pos; // position of the last match
|
pos_T pos; // position of the last match
|
||||||
@ -1500,7 +1500,7 @@ int searchc(cmdarg_T *cap, int t_cmd)
|
|||||||
{
|
{
|
||||||
int c = cap->nchar; // char to search for
|
int c = cap->nchar; // char to search for
|
||||||
int dir = cap->arg; // true for searching forward
|
int dir = cap->arg; // true for searching forward
|
||||||
long count = cap->count1; // repeat count
|
int count = cap->count1; // repeat count
|
||||||
bool stop = true;
|
bool stop = true;
|
||||||
|
|
||||||
if (c != NUL) { // normal search: remember args for repeat
|
if (c != NUL) { // normal search: remember args for repeat
|
||||||
@ -2380,7 +2380,7 @@ void showmatch(int c)
|
|||||||
/// Used while an operator is pending, and in Visual mode.
|
/// Used while an operator is pending, and in Visual mode.
|
||||||
///
|
///
|
||||||
/// @param forward true for forward, false for backward
|
/// @param forward true for forward, false for backward
|
||||||
int current_search(long count, bool forward)
|
int current_search(int count, bool forward)
|
||||||
{
|
{
|
||||||
bool old_p_ws = p_ws;
|
bool old_p_ws = p_ws;
|
||||||
pos_T save_VIsual = VIsual;
|
pos_T save_VIsual = VIsual;
|
||||||
@ -3546,12 +3546,12 @@ static char *get_line_and_copy(linenr_T lnum, char *buf)
|
|||||||
/// @param start_lnum first line to start searching
|
/// @param start_lnum first line to start searching
|
||||||
/// @param end_lnum last line for searching
|
/// @param end_lnum last line for searching
|
||||||
void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool skip_comments,
|
void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool skip_comments,
|
||||||
int type, long count, int action, linenr_T start_lnum, linenr_T end_lnum)
|
int type, int count, int action, linenr_T start_lnum, linenr_T end_lnum)
|
||||||
{
|
{
|
||||||
SearchedFile *files; // Stack of included files
|
SearchedFile *files; // Stack of included files
|
||||||
SearchedFile *bigger; // When we need more space
|
SearchedFile *bigger; // When we need more space
|
||||||
int max_path_depth = 50;
|
int max_path_depth = 50;
|
||||||
long match_count = 1;
|
int match_count = 1;
|
||||||
|
|
||||||
char *pat;
|
char *pat;
|
||||||
char *new_fname;
|
char *new_fname;
|
||||||
@ -4142,7 +4142,7 @@ fpip_end:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void show_pat_in_path(char *line, int type, bool did_show, int action, FILE *fp,
|
static void show_pat_in_path(char *line, int type, bool did_show, int action, FILE *fp,
|
||||||
linenr_T *lnum, long count)
|
linenr_T *lnum, int count)
|
||||||
FUNC_ATTR_NONNULL_ARG(1, 6)
|
FUNC_ATTR_NONNULL_ARG(1, 6)
|
||||||
{
|
{
|
||||||
if (did_show) {
|
if (did_show) {
|
||||||
@ -4166,7 +4166,7 @@ static void show_pat_in_path(char *line, int type, bool did_show, int action, FI
|
|||||||
*(p + 1) = NUL;
|
*(p + 1) = NUL;
|
||||||
}
|
}
|
||||||
if (action == ACTION_SHOW_ALL) {
|
if (action == ACTION_SHOW_ALL) {
|
||||||
snprintf(IObuff, IOSIZE, "%3ld: ", count); // Show match nr.
|
snprintf(IObuff, IOSIZE, "%3d: ", count); // Show match nr.
|
||||||
msg_puts(IObuff);
|
msg_puts(IObuff);
|
||||||
snprintf(IObuff, IOSIZE, "%4" PRIdLINENR, *lnum); // Show line nr.
|
snprintf(IObuff, IOSIZE, "%4" PRIdLINENR, *lnum); // Show line nr.
|
||||||
// Highlight line numbers.
|
// Highlight line numbers.
|
||||||
|
@ -1688,7 +1688,7 @@ static int spell_read_tree(FILE *fd, uint8_t **bytsp, long *bytsp_len, idx_T **i
|
|||||||
|
|
||||||
// The tree size was computed when writing the file, so that we can
|
// The tree size was computed when writing the file, so that we can
|
||||||
// allocate it as one long block. <nodecount>
|
// allocate it as one long block. <nodecount>
|
||||||
long len = get4c(fd);
|
int len = get4c(fd);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
return SP_TRUNCERROR;
|
return SP_TRUNCERROR;
|
||||||
}
|
}
|
||||||
@ -1712,7 +1712,7 @@ static int spell_read_tree(FILE *fd, uint8_t **bytsp, long *bytsp_len, idx_T **i
|
|||||||
*idxsp = ip;
|
*idxsp = ip;
|
||||||
|
|
||||||
// Recursively read the tree and store it in the array.
|
// Recursively read the tree and store it in the array.
|
||||||
idx = read_tree_node(fd, bp, ip, (int)len, 0, prefixtree, prefixcnt);
|
idx = read_tree_node(fd, bp, ip, len, 0, prefixtree, prefixcnt);
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ void stl_clear_click_defs(StlClickDefinition *const click_defs, const size_t cli
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Allocate or resize the click definitions array if needed.
|
/// Allocate or resize the click definitions array if needed.
|
||||||
StlClickDefinition *stl_alloc_click_defs(StlClickDefinition *cdp, long width, size_t *size)
|
StlClickDefinition *stl_alloc_click_defs(StlClickDefinition *cdp, int width, size_t *size)
|
||||||
{
|
{
|
||||||
if (*size < (size_t)width) {
|
if (*size < (size_t)width) {
|
||||||
xfree(cdp);
|
xfree(cdp);
|
||||||
|
@ -1020,10 +1020,10 @@ static int add_llist_tags(char *tag, int num_matches, char **matches)
|
|||||||
|
|
||||||
// Get the line number or the search pattern used to locate
|
// Get the line number or the search pattern used to locate
|
||||||
// the tag.
|
// the tag.
|
||||||
long lnum = 0;
|
linenr_T lnum = 0;
|
||||||
if (isdigit((uint8_t)(*tagp.command))) {
|
if (isdigit((uint8_t)(*tagp.command))) {
|
||||||
// Line number is used to locate the tag
|
// Line number is used to locate the tag
|
||||||
lnum = atol(tagp.command);
|
lnum = atoi(tagp.command);
|
||||||
} else {
|
} else {
|
||||||
char *cmd_start, *cmd_end;
|
char *cmd_start, *cmd_end;
|
||||||
|
|
||||||
@ -2979,15 +2979,14 @@ static int jumpto_tag(const char *lbuf_arg, int forceit, int keep_help)
|
|||||||
// start search before first line
|
// start search before first line
|
||||||
curwin->w_cursor.lnum = 0;
|
curwin->w_cursor.lnum = 0;
|
||||||
}
|
}
|
||||||
if (do_search(NULL, pbuf[0], pbuf[0], pbuf + 1, (long)1,
|
if (do_search(NULL, pbuf[0], pbuf[0], pbuf + 1, 1, search_options, NULL)) {
|
||||||
search_options, NULL)) {
|
|
||||||
retval = OK;
|
retval = OK;
|
||||||
} else {
|
} else {
|
||||||
int found = 1;
|
int found = 1;
|
||||||
|
|
||||||
// try again, ignore case now
|
// try again, ignore case now
|
||||||
p_ic = true;
|
p_ic = true;
|
||||||
if (!do_search(NULL, pbuf[0], pbuf[0], pbuf + 1, (long)1,
|
if (!do_search(NULL, pbuf[0], pbuf[0], pbuf + 1, 1,
|
||||||
search_options, NULL)) {
|
search_options, NULL)) {
|
||||||
// Failed to find pattern, take a guess: "^func ("
|
// Failed to find pattern, take a guess: "^func ("
|
||||||
found = 2;
|
found = 2;
|
||||||
@ -2995,11 +2994,11 @@ static int jumpto_tag(const char *lbuf_arg, int forceit, int keep_help)
|
|||||||
char cc = *tagp.tagname_end;
|
char cc = *tagp.tagname_end;
|
||||||
*tagp.tagname_end = NUL;
|
*tagp.tagname_end = NUL;
|
||||||
snprintf(pbuf, LSIZE, "^%s\\s\\*(", tagp.tagname);
|
snprintf(pbuf, LSIZE, "^%s\\s\\*(", tagp.tagname);
|
||||||
if (!do_search(NULL, '/', '/', pbuf, (long)1, search_options, NULL)) {
|
if (!do_search(NULL, '/', '/', pbuf, 1, search_options, NULL)) {
|
||||||
// Guess again: "^char * \<func ("
|
// Guess again: "^char * \<func ("
|
||||||
snprintf(pbuf, LSIZE, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
|
snprintf(pbuf, LSIZE, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
|
||||||
tagp.tagname);
|
tagp.tagname);
|
||||||
if (!do_search(NULL, '/', '/', pbuf, (long)1, search_options, NULL)) {
|
if (!do_search(NULL, '/', '/', pbuf, 1, search_options, NULL)) {
|
||||||
found = 0;
|
found = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1444,7 +1444,7 @@ static bool send_mouse_event(Terminal *term, int c)
|
|||||||
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
|
||||||
scroll_redraw(direction, curwin->w_botline - curwin->w_topline);
|
scroll_redraw(direction, curwin->w_botline - curwin->w_topline);
|
||||||
} else if (p_mousescroll_vert > 0) {
|
} else if (p_mousescroll_vert > 0) {
|
||||||
scroll_redraw(direction, p_mousescroll_vert);
|
scroll_redraw(direction, (linenr_T)p_mousescroll_vert);
|
||||||
}
|
}
|
||||||
|
|
||||||
curwin->w_redr_status = true;
|
curwin->w_redr_status = true;
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
/// sentence when found. If the next sentence is found, return OK. Return FAIL
|
/// sentence when found. If the next sentence is found, return OK. Return FAIL
|
||||||
/// otherwise. See ":h sentence" for the precise definition of a "sentence"
|
/// otherwise. See ":h sentence" for the precise definition of a "sentence"
|
||||||
/// text object.
|
/// text object.
|
||||||
int findsent(Direction dir, long count)
|
int findsent(Direction dir, int count)
|
||||||
{
|
{
|
||||||
pos_T pos, tpos;
|
pos_T pos, tpos;
|
||||||
int c;
|
int c;
|
||||||
@ -173,7 +173,7 @@ found:
|
|||||||
/// @param pincl Return: true if last char is to be included
|
/// @param pincl Return: true if last char is to be included
|
||||||
///
|
///
|
||||||
/// @return true if the next paragraph or section was found.
|
/// @return true if the next paragraph or section was found.
|
||||||
bool findpar(bool *pincl, int dir, long count, int what, bool both)
|
bool findpar(bool *pincl, int dir, int count, int what, bool both)
|
||||||
{
|
{
|
||||||
linenr_T curr;
|
linenr_T curr;
|
||||||
bool first; // true on first line
|
bool first; // true on first line
|
||||||
@ -321,7 +321,7 @@ static int cls(void)
|
|||||||
/// If eol is true, last word stops at end of line (for operators).
|
/// If eol is true, last word stops at end of line (for operators).
|
||||||
///
|
///
|
||||||
/// @param bigword "W", "E" or "B"
|
/// @param bigword "W", "E" or "B"
|
||||||
int fwd_word(long count, bool bigword, bool eol)
|
int fwd_word(int count, bool bigword, bool eol)
|
||||||
{
|
{
|
||||||
curwin->w_cursor.coladd = 0;
|
curwin->w_cursor.coladd = 0;
|
||||||
cls_bigword = bigword;
|
cls_bigword = bigword;
|
||||||
@ -375,7 +375,7 @@ int fwd_word(long count, bool bigword, bool eol)
|
|||||||
/// If stop is true and we are already on the start of a word, move one less.
|
/// If stop is true and we are already on the start of a word, move one less.
|
||||||
///
|
///
|
||||||
/// Returns FAIL if top of the file was reached.
|
/// Returns FAIL if top of the file was reached.
|
||||||
int bck_word(long count, bool bigword, bool stop)
|
int bck_word(int count, bool bigword, bool stop)
|
||||||
{
|
{
|
||||||
int sclass; // starting class
|
int sclass; // starting class
|
||||||
|
|
||||||
@ -432,7 +432,7 @@ finished:
|
|||||||
///
|
///
|
||||||
/// If stop is true and we are already on the end of a word, move one less.
|
/// If stop is true and we are already on the end of a word, move one less.
|
||||||
/// If empty is true stop on an empty line.
|
/// If empty is true stop on an empty line.
|
||||||
int end_word(long count, bool bigword, bool stop, bool empty)
|
int end_word(int count, bool bigword, bool stop, bool empty)
|
||||||
{
|
{
|
||||||
int sclass; // starting class
|
int sclass; // starting class
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ finished:
|
|||||||
/// @param eol if true, then stop at end of line.
|
/// @param eol if true, then stop at end of line.
|
||||||
///
|
///
|
||||||
/// @return FAIL if start of the file was reached.
|
/// @return FAIL if start of the file was reached.
|
||||||
int bckend_word(long count, bool bigword, bool eol)
|
int bckend_word(int count, bool bigword, bool eol)
|
||||||
{
|
{
|
||||||
curwin->w_cursor.coladd = 0;
|
curwin->w_cursor.coladd = 0;
|
||||||
cls_bigword = bigword;
|
cls_bigword = bigword;
|
||||||
@ -569,7 +569,7 @@ static void find_first_blank(pos_T *posp)
|
|||||||
/// Skip count/2 sentences and count/2 separating white spaces.
|
/// Skip count/2 sentences and count/2 separating white spaces.
|
||||||
///
|
///
|
||||||
/// @param at_start_sent cursor is at start of sentence
|
/// @param at_start_sent cursor is at start of sentence
|
||||||
static void findsent_forward(long count, bool at_start_sent)
|
static void findsent_forward(int count, bool at_start_sent)
|
||||||
{
|
{
|
||||||
while (count--) {
|
while (count--) {
|
||||||
findsent(FORWARD, 1L);
|
findsent(FORWARD, 1L);
|
||||||
@ -588,7 +588,7 @@ static void findsent_forward(long count, bool at_start_sent)
|
|||||||
///
|
///
|
||||||
/// @param include true: include word and white space
|
/// @param include true: include word and white space
|
||||||
/// @param bigword false == word, true == WORD
|
/// @param bigword false == word, true == WORD
|
||||||
int current_word(oparg_T *oap, long count, bool include, bool bigword)
|
int current_word(oparg_T *oap, int count, bool include, bool bigword)
|
||||||
{
|
{
|
||||||
pos_T start_pos;
|
pos_T start_pos;
|
||||||
bool inclusive = true;
|
bool inclusive = true;
|
||||||
@ -727,7 +727,7 @@ int current_word(oparg_T *oap, long count, bool include, bool bigword)
|
|||||||
|
|
||||||
/// Find sentence(s) under the cursor, cursor at end.
|
/// Find sentence(s) under the cursor, cursor at end.
|
||||||
/// When Visual active, extend it by one or more sentences.
|
/// When Visual active, extend it by one or more sentences.
|
||||||
int current_sent(oparg_T *oap, long count, bool include)
|
int current_sent(oparg_T *oap, int count, bool include)
|
||||||
{
|
{
|
||||||
pos_T start_pos;
|
pos_T start_pos;
|
||||||
pos_T pos;
|
pos_T pos;
|
||||||
@ -839,7 +839,7 @@ extend:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ncount > 0) {
|
if (ncount > 0) {
|
||||||
findsent_forward(ncount, true);
|
findsent_forward((int)ncount, true);
|
||||||
} else {
|
} else {
|
||||||
decl(&curwin->w_cursor);
|
decl(&curwin->w_cursor);
|
||||||
}
|
}
|
||||||
@ -890,7 +890,7 @@ extend:
|
|||||||
/// @param include true == include white space
|
/// @param include true == include white space
|
||||||
/// @param what '(', '{', etc.
|
/// @param what '(', '{', etc.
|
||||||
/// @param other ')', '}', etc.
|
/// @param other ')', '}', etc.
|
||||||
int current_block(oparg_T *oap, long count, bool include, int what, int other)
|
int current_block(oparg_T *oap, int count, bool include, int what, int other)
|
||||||
{
|
{
|
||||||
pos_T old_pos;
|
pos_T old_pos;
|
||||||
pos_T *pos = NULL;
|
pos_T *pos = NULL;
|
||||||
@ -1081,9 +1081,9 @@ static bool in_html_tag(bool end_tag)
|
|||||||
/// Find tag block under the cursor, cursor at end.
|
/// Find tag block under the cursor, cursor at end.
|
||||||
///
|
///
|
||||||
/// @param include true == include white space
|
/// @param include true == include white space
|
||||||
int current_tagblock(oparg_T *oap, long count_arg, bool include)
|
int current_tagblock(oparg_T *oap, int count_arg, bool include)
|
||||||
{
|
{
|
||||||
long count = count_arg;
|
int count = count_arg;
|
||||||
pos_T old_pos;
|
pos_T old_pos;
|
||||||
pos_T start_pos;
|
pos_T start_pos;
|
||||||
pos_T end_pos;
|
pos_T end_pos;
|
||||||
@ -1265,7 +1265,7 @@ theend:
|
|||||||
|
|
||||||
/// @param include true == include white space
|
/// @param include true == include white space
|
||||||
/// @param type 'p' for paragraph, 'S' for section
|
/// @param type 'p' for paragraph, 'S' for section
|
||||||
int current_par(oparg_T *oap, long count, bool include, int type)
|
int current_par(oparg_T *oap, int count, bool include, int type)
|
||||||
{
|
{
|
||||||
linenr_T start_lnum;
|
linenr_T start_lnum;
|
||||||
linenr_T end_lnum;
|
linenr_T end_lnum;
|
||||||
@ -1292,7 +1292,7 @@ extend:
|
|||||||
} else {
|
} else {
|
||||||
dir = FORWARD;
|
dir = FORWARD;
|
||||||
}
|
}
|
||||||
for (i = (int)count; --i >= 0;) {
|
for (i = count; --i >= 0;) {
|
||||||
if (start_lnum ==
|
if (start_lnum ==
|
||||||
(dir == BACKWARD ? 1 : curbuf->b_ml.ml_line_count)) {
|
(dir == BACKWARD ? 1 : curbuf->b_ml.ml_line_count)) {
|
||||||
retval = FAIL;
|
retval = FAIL;
|
||||||
@ -1357,7 +1357,7 @@ extend:
|
|||||||
}
|
}
|
||||||
|
|
||||||
end_lnum--;
|
end_lnum--;
|
||||||
i = (int)count;
|
i = count;
|
||||||
if (!include && white_in_front) {
|
if (!include && white_in_front) {
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
@ -1485,7 +1485,7 @@ static int find_prev_quote(char *line, int col_start, int quotechar, char *escap
|
|||||||
/// @param quotechar Quote character
|
/// @param quotechar Quote character
|
||||||
///
|
///
|
||||||
/// @return true if found, else false.
|
/// @return true if found, else false.
|
||||||
bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
|
bool current_quote(oparg_T *oap, int count, bool include, int quotechar)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
char *line = get_cursor_line_ptr();
|
char *line = get_cursor_line_ptr();
|
||||||
|
@ -2478,7 +2478,7 @@ static void u_undoredo(int undo, bool do_buf_event)
|
|||||||
if (curhead->uh_cursor.lnum == curwin->w_cursor.lnum) {
|
if (curhead->uh_cursor.lnum == curwin->w_cursor.lnum) {
|
||||||
curwin->w_cursor.col = curhead->uh_cursor.col;
|
curwin->w_cursor.col = curhead->uh_cursor.col;
|
||||||
if (virtual_active() && curhead->uh_cursor_vcol >= 0) {
|
if (virtual_active() && curhead->uh_cursor_vcol >= 0) {
|
||||||
coladvance((colnr_T)curhead->uh_cursor_vcol);
|
coladvance(curhead->uh_cursor_vcol);
|
||||||
} else {
|
} else {
|
||||||
curwin->w_cursor.coladd = 0;
|
curwin->w_cursor.coladd = 0;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ struct u_header {
|
|||||||
u_entry_T *uh_entry; // pointer to first entry
|
u_entry_T *uh_entry; // pointer to first entry
|
||||||
u_entry_T *uh_getbot_entry; // pointer to where ue_bot must be set
|
u_entry_T *uh_getbot_entry; // pointer to where ue_bot must be set
|
||||||
pos_T uh_cursor; // cursor position before saving
|
pos_T uh_cursor; // cursor position before saving
|
||||||
long uh_cursor_vcol;
|
colnr_T uh_cursor_vcol;
|
||||||
int uh_flags; // see below
|
int uh_flags; // see below
|
||||||
fmark_T uh_namedm[NMARKS]; // marks before undo/after redo
|
fmark_T uh_namedm[NMARKS]; // marks before undo/after redo
|
||||||
extmark_undo_vec_t uh_extmark; // info to move extmarks
|
extmark_undo_vec_t uh_extmark; // info to move extmarks
|
||||||
|
@ -168,12 +168,12 @@ win_T *swbuf_goto_win_with_buf(buf_T *buf)
|
|||||||
/// all CTRL-W window commands are handled here, called from normal_cmd().
|
/// all CTRL-W window commands are handled here, called from normal_cmd().
|
||||||
///
|
///
|
||||||
/// @param xchar extra char from ":wincmd gx" or NUL
|
/// @param xchar extra char from ":wincmd gx" or NUL
|
||||||
void do_window(int nchar, long Prenum, int xchar)
|
void do_window(int nchar, int Prenum, int xchar)
|
||||||
{
|
{
|
||||||
int type = FIND_DEFINE;
|
int type = FIND_DEFINE;
|
||||||
char cbuf[40];
|
char cbuf[40];
|
||||||
|
|
||||||
long Prenum1 = Prenum == 0 ? 1 : Prenum;
|
int Prenum1 = Prenum == 0 ? 1 : Prenum;
|
||||||
|
|
||||||
#define CHECK_CMDWIN \
|
#define CHECK_CMDWIN \
|
||||||
do { \
|
do { \
|
||||||
@ -195,7 +195,7 @@ void do_window(int nchar, long Prenum, int xchar)
|
|||||||
if (bt_quickfix(curbuf)) {
|
if (bt_quickfix(curbuf)) {
|
||||||
goto newwindow;
|
goto newwindow;
|
||||||
}
|
}
|
||||||
(void)win_split((int)Prenum, 0);
|
(void)win_split(Prenum, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// split current window in two parts, vertically
|
// split current window in two parts, vertically
|
||||||
@ -208,7 +208,7 @@ void do_window(int nchar, long Prenum, int xchar)
|
|||||||
if (bt_quickfix(curbuf)) {
|
if (bt_quickfix(curbuf)) {
|
||||||
goto newwindow;
|
goto newwindow;
|
||||||
}
|
}
|
||||||
(void)win_split((int)Prenum, WSP_VERT);
|
(void)win_split(Prenum, WSP_VERT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// split current window and edit alternate file
|
// split current window and edit alternate file
|
||||||
@ -217,7 +217,7 @@ void do_window(int nchar, long Prenum, int xchar)
|
|||||||
CHECK_CMDWIN;
|
CHECK_CMDWIN;
|
||||||
reset_VIsual_and_resel(); // stop Visual mode
|
reset_VIsual_and_resel(); // stop Visual mode
|
||||||
|
|
||||||
if (buflist_findnr(Prenum == 0 ? curwin->w_alt_fnum : (int)Prenum) == NULL) {
|
if (buflist_findnr(Prenum == 0 ? curwin->w_alt_fnum : Prenum) == NULL) {
|
||||||
if (Prenum == 0) {
|
if (Prenum == 0) {
|
||||||
emsg(_(e_noalt));
|
emsg(_(e_noalt));
|
||||||
} else {
|
} else {
|
||||||
@ -227,7 +227,7 @@ void do_window(int nchar, long Prenum, int xchar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!curbuf_locked() && win_split(0, 0) == OK) {
|
if (!curbuf_locked() && win_split(0, 0) == OK) {
|
||||||
(void)buflist_getfile(Prenum == 0 ? curwin->w_alt_fnum : (int)Prenum,
|
(void)buflist_getfile(Prenum == 0 ? curwin->w_alt_fnum : Prenum,
|
||||||
(linenr_T)0, GETF_ALT, false);
|
(linenr_T)0, GETF_ALT, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -387,7 +387,7 @@ newwindow:
|
|||||||
// First create a new tab with the window, then go back to
|
// First create a new tab with the window, then go back to
|
||||||
// the old tab and close the window there.
|
// the old tab and close the window there.
|
||||||
win_T *wp = curwin;
|
win_T *wp = curwin;
|
||||||
if (win_new_tabpage((int)Prenum, NULL) == OK
|
if (win_new_tabpage(Prenum, NULL) == OK
|
||||||
&& valid_tabpage(oldtab)) {
|
&& valid_tabpage(oldtab)) {
|
||||||
tabpage_T *newtab = curtab;
|
tabpage_T *newtab = curtab;
|
||||||
goto_tabpage_tp(oldtab, true, true);
|
goto_tabpage_tp(oldtab, true, true);
|
||||||
@ -436,14 +436,14 @@ newwindow:
|
|||||||
case 'r':
|
case 'r':
|
||||||
CHECK_CMDWIN;
|
CHECK_CMDWIN;
|
||||||
reset_VIsual_and_resel(); // stop Visual mode
|
reset_VIsual_and_resel(); // stop Visual mode
|
||||||
win_rotate(false, (int)Prenum1); // downwards
|
win_rotate(false, Prenum1); // downwards
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// rotate windows upwards
|
// rotate windows upwards
|
||||||
case 'R':
|
case 'R':
|
||||||
CHECK_CMDWIN;
|
CHECK_CMDWIN;
|
||||||
reset_VIsual_and_resel(); // stop Visual mode
|
reset_VIsual_and_resel(); // stop Visual mode
|
||||||
win_rotate(true, (int)Prenum1); // upwards
|
win_rotate(true, Prenum1); // upwards
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// move window to the very top/bottom/left/right
|
// move window to the very top/bottom/left/right
|
||||||
@ -452,7 +452,7 @@ newwindow:
|
|||||||
case 'H':
|
case 'H':
|
||||||
case 'L':
|
case 'L':
|
||||||
CHECK_CMDWIN;
|
CHECK_CMDWIN;
|
||||||
win_totop((int)Prenum,
|
win_totop(Prenum,
|
||||||
((nchar == 'H' || nchar == 'L') ? WSP_VERT : 0)
|
((nchar == 'H' || nchar == 'L') ? WSP_VERT : 0)
|
||||||
| ((nchar == 'H' || nchar == 'K') ? WSP_TOP : WSP_BOT));
|
| ((nchar == 'H' || nchar == 'K') ? WSP_TOP : WSP_BOT));
|
||||||
break;
|
break;
|
||||||
@ -466,40 +466,40 @@ newwindow:
|
|||||||
|
|
||||||
// increase current window height
|
// increase current window height
|
||||||
case '+':
|
case '+':
|
||||||
win_setheight(curwin->w_height + (int)Prenum1);
|
win_setheight(curwin->w_height + Prenum1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// decrease current window height
|
// decrease current window height
|
||||||
case '-':
|
case '-':
|
||||||
win_setheight(curwin->w_height - (int)Prenum1);
|
win_setheight(curwin->w_height - Prenum1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// set current window height
|
// set current window height
|
||||||
case Ctrl__:
|
case Ctrl__:
|
||||||
case '_':
|
case '_':
|
||||||
win_setheight(Prenum ? (int)Prenum : Rows - 1);
|
win_setheight(Prenum ? Prenum : Rows - 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// increase current window width
|
// increase current window width
|
||||||
case '>':
|
case '>':
|
||||||
win_setwidth(curwin->w_width + (int)Prenum1);
|
win_setwidth(curwin->w_width + Prenum1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// decrease current window width
|
// decrease current window width
|
||||||
case '<':
|
case '<':
|
||||||
win_setwidth(curwin->w_width - (int)Prenum1);
|
win_setwidth(curwin->w_width - Prenum1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// set current window width
|
// set current window width
|
||||||
case '|':
|
case '|':
|
||||||
win_setwidth(Prenum != 0 ? (int)Prenum : Columns);
|
win_setwidth(Prenum != 0 ? Prenum : Columns);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// jump to tag and split window if tag exists (in preview window)
|
// jump to tag and split window if tag exists (in preview window)
|
||||||
case '}':
|
case '}':
|
||||||
CHECK_CMDWIN;
|
CHECK_CMDWIN;
|
||||||
if (Prenum) {
|
if (Prenum) {
|
||||||
g_do_tagpreview = (int)Prenum;
|
g_do_tagpreview = Prenum;
|
||||||
} else {
|
} else {
|
||||||
g_do_tagpreview = (int)p_pvh;
|
g_do_tagpreview = (int)p_pvh;
|
||||||
}
|
}
|
||||||
@ -509,7 +509,7 @@ newwindow:
|
|||||||
CHECK_CMDWIN;
|
CHECK_CMDWIN;
|
||||||
// Keep visual mode, can select words to use as a tag.
|
// Keep visual mode, can select words to use as a tag.
|
||||||
if (Prenum) {
|
if (Prenum) {
|
||||||
postponed_split = (int)Prenum;
|
postponed_split = Prenum;
|
||||||
} else {
|
} else {
|
||||||
postponed_split = -1;
|
postponed_split = -1;
|
||||||
}
|
}
|
||||||
@ -621,7 +621,7 @@ wingotofile:
|
|||||||
case '}':
|
case '}':
|
||||||
xchar = Ctrl_RSB;
|
xchar = Ctrl_RSB;
|
||||||
if (Prenum) {
|
if (Prenum) {
|
||||||
g_do_tagpreview = (int)Prenum;
|
g_do_tagpreview = Prenum;
|
||||||
} else {
|
} else {
|
||||||
g_do_tagpreview = (int)p_pvh;
|
g_do_tagpreview = (int)p_pvh;
|
||||||
}
|
}
|
||||||
@ -630,7 +630,7 @@ wingotofile:
|
|||||||
case Ctrl_RSB:
|
case Ctrl_RSB:
|
||||||
// Keep visual mode, can select words to use as a tag.
|
// Keep visual mode, can select words to use as a tag.
|
||||||
if (Prenum) {
|
if (Prenum) {
|
||||||
postponed_split = (int)Prenum;
|
postponed_split = Prenum;
|
||||||
} else {
|
} else {
|
||||||
postponed_split = -1;
|
postponed_split = -1;
|
||||||
}
|
}
|
||||||
@ -648,11 +648,11 @@ wingotofile:
|
|||||||
goto wingotofile;
|
goto wingotofile;
|
||||||
|
|
||||||
case 't': // CTRL-W gt: go to next tab page
|
case 't': // CTRL-W gt: go to next tab page
|
||||||
goto_tabpage((int)Prenum);
|
goto_tabpage(Prenum);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T': // CTRL-W gT: go to previous tab page
|
case 'T': // CTRL-W gT: go to previous tab page
|
||||||
goto_tabpage(-(int)Prenum1);
|
goto_tabpage(-Prenum1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TAB: // CTRL-W g<Tab>: go to last used tab page
|
case TAB: // CTRL-W g<Tab>: go to last used tab page
|
||||||
@ -1849,7 +1849,7 @@ int make_windows(int count, bool vertical)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Exchange current and next window
|
// Exchange current and next window
|
||||||
static void win_exchange(long Prenum)
|
static void win_exchange(int Prenum)
|
||||||
{
|
{
|
||||||
if (curwin->w_floating) {
|
if (curwin->w_floating) {
|
||||||
emsg(e_floatexchange);
|
emsg(e_floatexchange);
|
||||||
@ -4668,7 +4668,7 @@ tabpage_T *win_find_tabpage(win_T *win)
|
|||||||
/// @param count nth neighbor window
|
/// @param count nth neighbor window
|
||||||
///
|
///
|
||||||
/// @return found window
|
/// @return found window
|
||||||
win_T *win_vert_neighbor(tabpage_T *tp, win_T *wp, bool up, long count)
|
win_T *win_vert_neighbor(tabpage_T *tp, win_T *wp, bool up, int count)
|
||||||
{
|
{
|
||||||
frame_T *foundfr = wp->w_frame;
|
frame_T *foundfr = wp->w_frame;
|
||||||
|
|
||||||
@ -4727,7 +4727,7 @@ end:
|
|||||||
///
|
///
|
||||||
/// @param up true to go to win above
|
/// @param up true to go to win above
|
||||||
/// @param count go count times into direction
|
/// @param count go count times into direction
|
||||||
static void win_goto_ver(bool up, long count)
|
static void win_goto_ver(bool up, int count)
|
||||||
{
|
{
|
||||||
win_T *win = win_vert_neighbor(curtab, curwin, up, count);
|
win_T *win = win_vert_neighbor(curtab, curwin, up, count);
|
||||||
if (win != NULL) {
|
if (win != NULL) {
|
||||||
@ -4744,7 +4744,7 @@ static void win_goto_ver(bool up, long count)
|
|||||||
/// @param count nth neighbor window
|
/// @param count nth neighbor window
|
||||||
///
|
///
|
||||||
/// @return found window
|
/// @return found window
|
||||||
win_T *win_horz_neighbor(tabpage_T *tp, win_T *wp, bool left, long count)
|
win_T *win_horz_neighbor(tabpage_T *tp, win_T *wp, bool left, int count)
|
||||||
{
|
{
|
||||||
frame_T *foundfr = wp->w_frame;
|
frame_T *foundfr = wp->w_frame;
|
||||||
|
|
||||||
@ -4803,7 +4803,7 @@ end:
|
|||||||
///
|
///
|
||||||
/// @param left true to go to left window
|
/// @param left true to go to left window
|
||||||
/// @param count go count times into direction
|
/// @param count go count times into direction
|
||||||
static void win_goto_hor(bool left, long count)
|
static void win_goto_hor(bool left, int count)
|
||||||
{
|
{
|
||||||
win_T *win = win_horz_neighbor(curtab, curwin, left, count);
|
win_T *win = win_horz_neighbor(curtab, curwin, left, count);
|
||||||
if (win != NULL) {
|
if (win != NULL) {
|
||||||
@ -5318,8 +5318,8 @@ static void frame_remove(frame_T *frp)
|
|||||||
|
|
||||||
void win_new_screensize(void)
|
void win_new_screensize(void)
|
||||||
{
|
{
|
||||||
static long old_Rows = 0;
|
static int old_Rows = 0;
|
||||||
static long old_Columns = 0;
|
static int old_Columns = 0;
|
||||||
|
|
||||||
if (old_Rows != Rows) {
|
if (old_Rows != Rows) {
|
||||||
// If 'window' uses the whole screen, keep it using that.
|
// If 'window' uses the whole screen, keep it using that.
|
||||||
@ -6475,7 +6475,7 @@ static void win_fix_cursor(int normal)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine valid cursor range.
|
// Determine valid cursor range.
|
||||||
long so = MIN(wp->w_height_inner / 2, get_scrolloff_value(wp));
|
linenr_T so = MIN(wp->w_height_inner / 2, get_scrolloff_value(wp));
|
||||||
linenr_T lnum = wp->w_cursor.lnum;
|
linenr_T lnum = wp->w_cursor.lnum;
|
||||||
|
|
||||||
wp->w_cursor.lnum = wp->w_topline;
|
wp->w_cursor.lnum = wp->w_topline;
|
||||||
@ -6812,7 +6812,7 @@ static void frame_add_height(frame_T *frp, int n)
|
|||||||
// Get the file name at the cursor.
|
// Get the file name at the cursor.
|
||||||
// If Visual mode is active, use the selected text if it's in one line.
|
// If Visual mode is active, use the selected text if it's in one line.
|
||||||
// Returns the name in allocated memory, NULL for failure.
|
// Returns the name in allocated memory, NULL for failure.
|
||||||
char *grab_file_name(long count, linenr_T *file_lnum)
|
char *grab_file_name(int count, linenr_T *file_lnum)
|
||||||
{
|
{
|
||||||
int options = FNAME_MESS | FNAME_EXP | FNAME_REL | FNAME_UNESC;
|
int options = FNAME_MESS | FNAME_EXP | FNAME_REL | FNAME_UNESC;
|
||||||
if (VIsual_active) {
|
if (VIsual_active) {
|
||||||
@ -6843,7 +6843,7 @@ char *grab_file_name(long count, linenr_T *file_lnum)
|
|||||||
// FNAME_EXP expand to path
|
// FNAME_EXP expand to path
|
||||||
// FNAME_HYP check for hypertext link
|
// FNAME_HYP check for hypertext link
|
||||||
// FNAME_INCL apply "includeexpr"
|
// FNAME_INCL apply "includeexpr"
|
||||||
char *file_name_at_cursor(int options, long count, linenr_T *file_lnum)
|
char *file_name_at_cursor(int options, int count, linenr_T *file_lnum)
|
||||||
{
|
{
|
||||||
return file_name_in_line(get_cursor_line_ptr(),
|
return file_name_in_line(get_cursor_line_ptr(),
|
||||||
curwin->w_cursor.col, options, count, curbuf->b_ffname,
|
curwin->w_cursor.col, options, count, curbuf->b_ffname,
|
||||||
@ -6854,7 +6854,7 @@ char *file_name_at_cursor(int options, long count, linenr_T *file_lnum)
|
|||||||
/// @param file_lnum line number after the file name
|
/// @param file_lnum line number after the file name
|
||||||
///
|
///
|
||||||
/// @return the name of the file under or after ptr[col]. Otherwise like file_name_at_cursor().
|
/// @return the name of the file under or after ptr[col]. Otherwise like file_name_at_cursor().
|
||||||
char *file_name_in_line(char *line, int col, int options, long count, char *rel_fname,
|
char *file_name_in_line(char *line, int col, int options, int count, char *rel_fname,
|
||||||
linenr_T *file_lnum)
|
linenr_T *file_lnum)
|
||||||
{
|
{
|
||||||
// search forward for what could be the start of a file name
|
// search forward for what could be the start of a file name
|
||||||
|
Loading…
Reference in New Issue
Block a user