mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 23:38:17 +00:00
refactor: reduce scope of locals as per the style guide (#22206)
This commit is contained in:
@@ -619,8 +619,6 @@ void ex_argument(exarg_T *eap)
|
|||||||
/// Edit file "argn" of the argument lists.
|
/// Edit file "argn" of the argument lists.
|
||||||
void do_argfile(exarg_T *eap, int argn)
|
void do_argfile(exarg_T *eap, int argn)
|
||||||
{
|
{
|
||||||
int other;
|
|
||||||
char *p;
|
|
||||||
int old_arg_idx = curwin->w_arg_idx;
|
int old_arg_idx = curwin->w_arg_idx;
|
||||||
|
|
||||||
if (argn < 0 || argn >= ARGCOUNT) {
|
if (argn < 0 || argn >= ARGCOUNT) {
|
||||||
@@ -646,9 +644,9 @@ void do_argfile(exarg_T *eap, int argn)
|
|||||||
} else {
|
} else {
|
||||||
// if 'hidden' set, only check for changed file when re-editing
|
// if 'hidden' set, only check for changed file when re-editing
|
||||||
// the same buffer
|
// the same buffer
|
||||||
other = true;
|
int other = true;
|
||||||
if (buf_hide(curbuf)) {
|
if (buf_hide(curbuf)) {
|
||||||
p = fix_fname(alist_name(&ARGLIST[argn]));
|
char *p = fix_fname(alist_name(&ARGLIST[argn]));
|
||||||
other = otherfile(p);
|
other = otherfile(p);
|
||||||
xfree(p);
|
xfree(p);
|
||||||
}
|
}
|
||||||
@@ -683,8 +681,6 @@ void do_argfile(exarg_T *eap, int argn)
|
|||||||
/// ":next", and commands that behave like it.
|
/// ":next", and commands that behave like it.
|
||||||
void ex_next(exarg_T *eap)
|
void ex_next(exarg_T *eap)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
// check for changed buffer now, if this fails the argument list is not
|
// check for changed buffer now, if this fails the argument list is not
|
||||||
// redefined.
|
// redefined.
|
||||||
if (buf_hide(curbuf)
|
if (buf_hide(curbuf)
|
||||||
@@ -692,6 +688,7 @@ void ex_next(exarg_T *eap)
|
|||||||
|| !check_changed(curbuf, CCGD_AW
|
|| !check_changed(curbuf, CCGD_AW
|
||||||
| (eap->forceit ? CCGD_FORCEIT : 0)
|
| (eap->forceit ? CCGD_FORCEIT : 0)
|
||||||
| CCGD_EXCMD)) {
|
| CCGD_EXCMD)) {
|
||||||
|
int i;
|
||||||
if (*eap->arg != NUL) { // redefine file list
|
if (*eap->arg != NUL) { // redefine file list
|
||||||
if (do_arglist(eap->arg, AL_SET, 0, true) == FAIL) {
|
if (do_arglist(eap->arg, AL_SET, 0, true) == FAIL) {
|
||||||
return;
|
return;
|
||||||
|
@@ -368,7 +368,6 @@ static int get_history_idx(int histype)
|
|||||||
static int calc_hist_idx(int histype, int num)
|
static int calc_hist_idx(int histype, int num)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int wrapped = false;
|
|
||||||
|
|
||||||
if (hislen == 0 || histype < 0 || histype >= HIST_COUNT
|
if (hislen == 0 || histype < 0 || histype >= HIST_COUNT
|
||||||
|| (i = hisidx[histype]) < 0 || num == 0) {
|
|| (i = hisidx[histype]) < 0 || num == 0) {
|
||||||
@@ -377,6 +376,7 @@ static int calc_hist_idx(int histype, int num)
|
|||||||
|
|
||||||
histentry_T *hist = history[histype];
|
histentry_T *hist = history[histype];
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
|
int wrapped = false;
|
||||||
while (hist[i].hisnum > num) {
|
while (hist[i].hisnum > num) {
|
||||||
if (--i < 0) {
|
if (--i < 0) {
|
||||||
if (wrapped) {
|
if (wrapped) {
|
||||||
@@ -568,14 +568,12 @@ void f_histdel(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
/// "histget()" function
|
/// "histget()" function
|
||||||
void f_histget(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
void f_histget(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||||
{
|
{
|
||||||
HistoryType type;
|
|
||||||
int idx;
|
|
||||||
|
|
||||||
const char *const str = tv_get_string_chk(&argvars[0]); // NULL on type error
|
const char *const str = tv_get_string_chk(&argvars[0]); // NULL on type error
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
rettv->vval.v_string = NULL;
|
rettv->vval.v_string = NULL;
|
||||||
} else {
|
} else {
|
||||||
type = get_histtype(str, strlen(str), false);
|
int idx;
|
||||||
|
HistoryType type = get_histtype(str, strlen(str), false);
|
||||||
if (argvars[1].v_type == VAR_UNKNOWN) {
|
if (argvars[1].v_type == VAR_UNKNOWN) {
|
||||||
idx = get_history_idx(type);
|
idx = get_history_idx(type);
|
||||||
} else {
|
} else {
|
||||||
@@ -603,13 +601,11 @@ void f_histnr(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
/// :history command - print a history
|
/// :history command - print a history
|
||||||
void ex_history(exarg_T *eap)
|
void ex_history(exarg_T *eap)
|
||||||
{
|
{
|
||||||
histentry_T *hist;
|
|
||||||
int histype1 = HIST_CMD;
|
int histype1 = HIST_CMD;
|
||||||
int histype2 = HIST_CMD;
|
int histype2 = HIST_CMD;
|
||||||
int hisidx1 = 1;
|
int hisidx1 = 1;
|
||||||
int hisidx2 = -1;
|
int hisidx2 = -1;
|
||||||
int idx;
|
int i;
|
||||||
int i, j, k;
|
|
||||||
char *end;
|
char *end;
|
||||||
char *arg = eap->arg;
|
char *arg = eap->arg;
|
||||||
|
|
||||||
@@ -649,10 +645,10 @@ void ex_history(exarg_T *eap)
|
|||||||
assert(history_names[histype1] != NULL);
|
assert(history_names[histype1] != NULL);
|
||||||
STRCAT(STRCAT(IObuff, history_names[histype1]), " history");
|
STRCAT(STRCAT(IObuff, history_names[histype1]), " history");
|
||||||
msg_puts_title(IObuff);
|
msg_puts_title(IObuff);
|
||||||
idx = hisidx[histype1];
|
int idx = hisidx[histype1];
|
||||||
hist = history[histype1];
|
histentry_T *hist = history[histype1];
|
||||||
j = hisidx1;
|
int j = hisidx1;
|
||||||
k = hisidx2;
|
int k = hisidx2;
|
||||||
if (j < 0) {
|
if (j < 0) {
|
||||||
j = (-j > hislen) ? 0 : hist[(hislen + j + idx + 1) % hislen].hisnum;
|
j = (-j > hislen) ? 0 : hist[(hislen + j + idx + 1) % hislen].hisnum;
|
||||||
}
|
}
|
||||||
|
@@ -558,10 +558,9 @@ static int insert_execute(VimState *state, int key)
|
|||||||
if (ins_compl_accept_char(s->c)) {
|
if (ins_compl_accept_char(s->c)) {
|
||||||
// Trigger InsertCharPre.
|
// Trigger InsertCharPre.
|
||||||
char *str = do_insert_char_pre(s->c);
|
char *str = do_insert_char_pre(s->c);
|
||||||
char *p;
|
|
||||||
|
|
||||||
if (str != NULL) {
|
if (str != NULL) {
|
||||||
for (p = str; *p != NUL; MB_PTR_ADV(p)) {
|
for (char *p = str; *p != NUL; MB_PTR_ADV(p)) {
|
||||||
ins_compl_addleader(utf_ptr2char(p));
|
ins_compl_addleader(utf_ptr2char(p));
|
||||||
}
|
}
|
||||||
xfree(str);
|
xfree(str);
|
||||||
@@ -1122,12 +1121,11 @@ normalchar:
|
|||||||
if (!p_paste) {
|
if (!p_paste) {
|
||||||
// Trigger InsertCharPre.
|
// Trigger InsertCharPre.
|
||||||
char *str = do_insert_char_pre(s->c);
|
char *str = do_insert_char_pre(s->c);
|
||||||
char *p;
|
|
||||||
|
|
||||||
if (str != NULL) {
|
if (str != NULL) {
|
||||||
if (*str != NUL && stop_arrow() != FAIL) {
|
if (*str != NUL && stop_arrow() != FAIL) {
|
||||||
// Insert the new value of v:char literally.
|
// Insert the new value of v:char literally.
|
||||||
for (p = str; *p != NUL; MB_PTR_ADV(p)) {
|
for (char *p = str; *p != NUL; MB_PTR_ADV(p)) {
|
||||||
s->c = utf_ptr2char(p);
|
s->c = utf_ptr2char(p);
|
||||||
if (s->c == CAR || s->c == K_KENTER || s->c == NL) {
|
if (s->c == CAR || s->c == K_KENTER || s->c == NL) {
|
||||||
ins_eol(s->c);
|
ins_eol(s->c);
|
||||||
@@ -1410,9 +1408,8 @@ static int pc_col;
|
|||||||
|
|
||||||
void edit_putchar(int c, bool highlight)
|
void edit_putchar(int c, bool highlight)
|
||||||
{
|
{
|
||||||
int attr;
|
|
||||||
|
|
||||||
if (curwin->w_grid_alloc.chars != NULL || default_grid.chars != NULL) {
|
if (curwin->w_grid_alloc.chars != NULL || default_grid.chars != NULL) {
|
||||||
|
int attr;
|
||||||
update_topline(curwin); // just in case w_topline isn't valid
|
update_topline(curwin); // just in case w_topline isn't valid
|
||||||
validate_cursor();
|
validate_cursor();
|
||||||
if (highlight) {
|
if (highlight) {
|
||||||
@@ -1583,7 +1580,7 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
|
|||||||
int start_col;
|
int start_col;
|
||||||
colnr_T vc;
|
colnr_T vc;
|
||||||
colnr_T orig_col = 0; // init for GCC
|
colnr_T orig_col = 0; // init for GCC
|
||||||
char *new_line, *orig_line = NULL; // init for GCC
|
char *orig_line = NULL; // init for GCC
|
||||||
|
|
||||||
// MODE_VREPLACE state needs to know what the line was like before changing
|
// MODE_VREPLACE state needs to know what the line was like before changing
|
||||||
if (State & VREPLACE_FLAG) {
|
if (State & VREPLACE_FLAG) {
|
||||||
@@ -1742,7 +1739,7 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
|
|||||||
// then put it back again the way we wanted it.
|
// then put it back again the way we wanted it.
|
||||||
if (State & VREPLACE_FLAG) {
|
if (State & VREPLACE_FLAG) {
|
||||||
// Save new line
|
// Save new line
|
||||||
new_line = xstrdup(get_cursor_line_ptr());
|
char *new_line = xstrdup(get_cursor_line_ptr());
|
||||||
|
|
||||||
// We only put back the new line up to the cursor
|
// We only put back the new line up to the cursor
|
||||||
new_line[curwin->w_cursor.col] = NUL;
|
new_line[curwin->w_cursor.col] = NUL;
|
||||||
@@ -1949,9 +1946,6 @@ int get_literal(bool no_simplify)
|
|||||||
/// @param ctrlv `c` was typed after CTRL-V
|
/// @param ctrlv `c` was typed after CTRL-V
|
||||||
static void insert_special(int c, int allow_modmask, int ctrlv)
|
static void insert_special(int c, int allow_modmask, int ctrlv)
|
||||||
{
|
{
|
||||||
char *p;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
// Special function key, translate into "<Key>". Up to the last '>' is
|
// Special function key, translate into "<Key>". Up to the last '>' is
|
||||||
// inserted with ins_str(), so as not to replace characters in replace
|
// inserted with ins_str(), so as not to replace characters in replace
|
||||||
// mode.
|
// mode.
|
||||||
@@ -1961,8 +1955,8 @@ static void insert_special(int c, int allow_modmask, int ctrlv)
|
|||||||
allow_modmask = true;
|
allow_modmask = true;
|
||||||
}
|
}
|
||||||
if (IS_SPECIAL(c) || (mod_mask && allow_modmask)) {
|
if (IS_SPECIAL(c) || (mod_mask && allow_modmask)) {
|
||||||
p = (char *)get_special_key_name(c, mod_mask);
|
char *p = (char *)get_special_key_name(c, mod_mask);
|
||||||
len = (int)strlen(p);
|
int len = (int)strlen(p);
|
||||||
c = (uint8_t)p[len - 1];
|
c = (uint8_t)p[len - 1];
|
||||||
if (len > 2) {
|
if (len > 2) {
|
||||||
if (stop_arrow() == FAIL) {
|
if (stop_arrow() == FAIL) {
|
||||||
@@ -2294,7 +2288,6 @@ int stop_arrow(void)
|
|||||||
/// @param nomove <c-\><c-o>, don't move cursor
|
/// @param nomove <c-\><c-o>, don't move cursor
|
||||||
static void stop_insert(pos_T *end_insert_pos, int esc, int nomove)
|
static void stop_insert(pos_T *end_insert_pos, int esc, int nomove)
|
||||||
{
|
{
|
||||||
int cc;
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
stop_redo_ins();
|
stop_redo_ins();
|
||||||
@@ -2314,6 +2307,7 @@ static void stop_insert(pos_T *end_insert_pos, int esc, int nomove)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!arrow_used && end_insert_pos != NULL) {
|
if (!arrow_used && end_insert_pos != NULL) {
|
||||||
|
int cc;
|
||||||
// Auto-format now. It may seem strange to do this when stopping an
|
// Auto-format now. It may seem strange to do this when stopping an
|
||||||
// insertion (or moving the cursor), but it's required when appending
|
// insertion (or moving the cursor), but it's required when appending
|
||||||
// a line and having it end in a space. But only do it when something
|
// a line and having it end in a space. But only do it when something
|
||||||
@@ -2883,7 +2877,6 @@ static void mb_replace_pop_ins(int cc)
|
|||||||
int n;
|
int n;
|
||||||
char_u buf[MB_MAXBYTES + 1];
|
char_u buf[MB_MAXBYTES + 1];
|
||||||
int i;
|
int i;
|
||||||
int c;
|
|
||||||
|
|
||||||
if ((n = MB_BYTE2LEN(cc)) > 1) {
|
if ((n = MB_BYTE2LEN(cc)) > 1) {
|
||||||
buf[0] = (char_u)cc;
|
buf[0] = (char_u)cc;
|
||||||
@@ -2897,7 +2890,7 @@ static void mb_replace_pop_ins(int cc)
|
|||||||
|
|
||||||
// Handle composing chars.
|
// Handle composing chars.
|
||||||
for (;;) {
|
for (;;) {
|
||||||
c = replace_pop();
|
int c = replace_pop();
|
||||||
if (c == -1) { // stack empty
|
if (c == -1) { // stack empty
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2943,17 +2936,13 @@ static void replace_flush(void)
|
|||||||
static void replace_do_bs(int limit_col)
|
static void replace_do_bs(int limit_col)
|
||||||
{
|
{
|
||||||
int cc;
|
int cc;
|
||||||
int orig_len = 0;
|
|
||||||
int ins_len;
|
|
||||||
int orig_vcols = 0;
|
|
||||||
colnr_T start_vcol;
|
colnr_T start_vcol;
|
||||||
char *p;
|
|
||||||
int i;
|
|
||||||
int vcol;
|
|
||||||
const int l_State = State;
|
const int l_State = State;
|
||||||
|
|
||||||
cc = replace_pop();
|
cc = replace_pop();
|
||||||
if (cc > 0) {
|
if (cc > 0) {
|
||||||
|
int orig_len = 0;
|
||||||
|
int orig_vcols = 0;
|
||||||
if (l_State & VREPLACE_FLAG) {
|
if (l_State & VREPLACE_FLAG) {
|
||||||
// Get the number of screen cells used by the character we are
|
// Get the number of screen cells used by the character we are
|
||||||
// going to delete.
|
// going to delete.
|
||||||
@@ -2969,10 +2958,10 @@ static void replace_do_bs(int limit_col)
|
|||||||
|
|
||||||
if (l_State & VREPLACE_FLAG) {
|
if (l_State & VREPLACE_FLAG) {
|
||||||
// Get the number of screen cells used by the inserted characters
|
// Get the number of screen cells used by the inserted characters
|
||||||
p = get_cursor_pos_ptr();
|
char *p = get_cursor_pos_ptr();
|
||||||
ins_len = (int)strlen(p) - orig_len;
|
int ins_len = (int)strlen(p) - orig_len;
|
||||||
vcol = start_vcol;
|
int vcol = start_vcol;
|
||||||
for (i = 0; i < ins_len; i++) {
|
for (int i = 0; i < ins_len; i++) {
|
||||||
vcol += win_chartabsize(curwin, p + i, vcol);
|
vcol += win_chartabsize(curwin, p + i, vcol);
|
||||||
i += utfc_ptr2len(p) - 1;
|
i += utfc_ptr2len(p) - 1;
|
||||||
}
|
}
|
||||||
@@ -3786,14 +3775,11 @@ static void ins_bs_one(colnr_T *vcolp)
|
|||||||
static bool ins_bs(int c, int mode, int *inserted_space_p)
|
static bool ins_bs(int c, int mode, int *inserted_space_p)
|
||||||
FUNC_ATTR_NONNULL_ARG(3)
|
FUNC_ATTR_NONNULL_ARG(3)
|
||||||
{
|
{
|
||||||
linenr_T lnum;
|
|
||||||
int cc;
|
int cc;
|
||||||
int temp = 0; // init for GCC
|
int temp = 0; // init for GCC
|
||||||
colnr_T save_col;
|
colnr_T save_col;
|
||||||
colnr_T mincol;
|
|
||||||
bool did_backspace = false;
|
bool did_backspace = false;
|
||||||
int in_indent;
|
int in_indent;
|
||||||
int oldState;
|
|
||||||
int cpc[MAX_MCO]; // composing characters
|
int cpc[MAX_MCO]; // composing characters
|
||||||
bool call_fix_indent = false;
|
bool call_fix_indent = false;
|
||||||
|
|
||||||
@@ -3844,7 +3830,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
|||||||
|
|
||||||
// Delete newline!
|
// Delete newline!
|
||||||
if (curwin->w_cursor.col == 0) {
|
if (curwin->w_cursor.col == 0) {
|
||||||
lnum = Insstart.lnum;
|
linenr_T lnum = Insstart.lnum;
|
||||||
if (curwin->w_cursor.lnum == lnum || revins_on) {
|
if (curwin->w_cursor.lnum == lnum || revins_on) {
|
||||||
if (u_save((linenr_T)(curwin->w_cursor.lnum - 2),
|
if (u_save((linenr_T)(curwin->w_cursor.lnum - 2),
|
||||||
(linenr_T)(curwin->w_cursor.lnum + 1)) == FAIL) {
|
(linenr_T)(curwin->w_cursor.lnum + 1)) == FAIL) {
|
||||||
@@ -3900,7 +3886,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
|||||||
// Do the next ins_char() in MODE_NORMAL state, to
|
// Do the next ins_char() in MODE_NORMAL state, to
|
||||||
// prevent ins_char() from replacing characters and
|
// prevent ins_char() from replacing characters and
|
||||||
// avoiding showmatch().
|
// avoiding showmatch().
|
||||||
oldState = State;
|
int oldState = State;
|
||||||
State = MODE_NORMAL;
|
State = MODE_NORMAL;
|
||||||
// restore characters (blanks) deleted after cursor
|
// restore characters (blanks) deleted after cursor
|
||||||
while (cc > 0) {
|
while (cc > 0) {
|
||||||
@@ -3920,7 +3906,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
|||||||
if (revins_on) { // put cursor on last inserted char
|
if (revins_on) { // put cursor on last inserted char
|
||||||
dec_cursor();
|
dec_cursor();
|
||||||
}
|
}
|
||||||
mincol = 0;
|
colnr_T mincol = 0;
|
||||||
// keep indent
|
// keep indent
|
||||||
if (mode == BACKSPACE_LINE
|
if (mode == BACKSPACE_LINE
|
||||||
&& (curbuf->b_p_ai || cindent_on())
|
&& (curbuf->b_p_ai || cindent_on())
|
||||||
@@ -3944,7 +3930,6 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
|||||||
&& (*(get_cursor_pos_ptr() - 1) == TAB
|
&& (*(get_cursor_pos_ptr() - 1) == TAB
|
||||||
|| (*(get_cursor_pos_ptr() - 1) == ' '
|
|| (*(get_cursor_pos_ptr() - 1) == ' '
|
||||||
&& (!*inserted_space_p || arrow_used)))))) {
|
&& (!*inserted_space_p || arrow_used)))))) {
|
||||||
int ts;
|
|
||||||
colnr_T vcol;
|
colnr_T vcol;
|
||||||
colnr_T want_vcol;
|
colnr_T want_vcol;
|
||||||
colnr_T start_vcol;
|
colnr_T start_vcol;
|
||||||
@@ -3959,7 +3944,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
|||||||
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &want_vcol);
|
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &want_vcol);
|
||||||
inc_cursor();
|
inc_cursor();
|
||||||
if (p_sta && in_indent) {
|
if (p_sta && in_indent) {
|
||||||
ts = get_sw_value(curbuf);
|
int ts = get_sw_value(curbuf);
|
||||||
want_vcol = (want_vcol / ts) * ts;
|
want_vcol = (want_vcol / ts) * ts;
|
||||||
} else {
|
} else {
|
||||||
want_vcol = tabstop_start(want_vcol,
|
want_vcol = tabstop_start(want_vcol,
|
||||||
@@ -3999,7 +3984,6 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Delete up to starting point, start of line or previous word.
|
// Delete up to starting point, start of line or previous word.
|
||||||
int prev_cclass = 0;
|
|
||||||
|
|
||||||
int cclass = mb_get_class(get_cursor_pos_ptr());
|
int cclass = mb_get_class(get_cursor_pos_ptr());
|
||||||
do {
|
do {
|
||||||
@@ -4008,7 +3992,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
|||||||
}
|
}
|
||||||
cc = gchar_cursor();
|
cc = gchar_cursor();
|
||||||
// look multi-byte character class
|
// look multi-byte character class
|
||||||
prev_cclass = cclass;
|
int prev_cclass = cclass;
|
||||||
cclass = mb_get_class(get_cursor_pos_ptr());
|
cclass = mb_get_class(get_cursor_pos_ptr());
|
||||||
if (mode == BACKSPACE_WORD && !ascii_isspace(cc)) { // start of word?
|
if (mode == BACKSPACE_WORD && !ascii_isspace(cc)) { // start of word?
|
||||||
mode = BACKSPACE_WORD_NOT_SPACE;
|
mode = BACKSPACE_WORD_NOT_SPACE;
|
||||||
@@ -4425,7 +4409,6 @@ static void ins_pagedown(void)
|
|||||||
static bool ins_tab(void)
|
static bool ins_tab(void)
|
||||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int temp;
|
int temp;
|
||||||
|
|
||||||
if (Insstart_blank_vcol == MAXCOL && curwin->w_cursor.lnum == Insstart.lnum) {
|
if (Insstart_blank_vcol == MAXCOL && curwin->w_cursor.lnum == Insstart.lnum) {
|
||||||
@@ -4501,6 +4484,7 @@ static bool ins_tab(void)
|
|||||||
if (!curbuf->b_p_et && (tabstop_count(curbuf->b_p_vsts_array) > 0
|
if (!curbuf->b_p_et && (tabstop_count(curbuf->b_p_vsts_array) > 0
|
||||||
|| get_sts_value() > 0
|
|| get_sts_value() > 0
|
||||||
|| (p_sta && ind))) {
|
|| (p_sta && ind))) {
|
||||||
|
int i;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
char *saved_line = NULL; // init for GCC
|
char *saved_line = NULL; // init for GCC
|
||||||
pos_T pos;
|
pos_T pos;
|
||||||
@@ -4690,7 +4674,6 @@ bool ins_eol(int c)
|
|||||||
static int ins_digraph(void)
|
static int ins_digraph(void)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int cc;
|
|
||||||
bool did_putchar = false;
|
bool did_putchar = false;
|
||||||
|
|
||||||
pc_status = PC_STATUS_UNSET;
|
pc_status = PC_STATUS_UNSET;
|
||||||
@@ -4736,7 +4719,7 @@ static int ins_digraph(void)
|
|||||||
}
|
}
|
||||||
no_mapping++;
|
no_mapping++;
|
||||||
allow_keys++;
|
allow_keys++;
|
||||||
cc = plain_vgetc();
|
int cc = plain_vgetc();
|
||||||
no_mapping--;
|
no_mapping--;
|
||||||
allow_keys--;
|
allow_keys--;
|
||||||
if (did_putchar) {
|
if (did_putchar) {
|
||||||
@@ -4835,13 +4818,14 @@ static int ins_ctrl_ey(int tc)
|
|||||||
// Used when inserting a "normal" character.
|
// Used when inserting a "normal" character.
|
||||||
static void ins_try_si(int c)
|
static void ins_try_si(int c)
|
||||||
{
|
{
|
||||||
pos_T *pos, old_pos;
|
pos_T *pos;
|
||||||
char *ptr;
|
|
||||||
int i;
|
|
||||||
bool temp;
|
|
||||||
|
|
||||||
// do some very smart indenting when entering '{' or '}'
|
// do some very smart indenting when entering '{' or '}'
|
||||||
if (((did_si || can_si_back) && c == '{') || (can_si && c == '}' && inindent(0))) {
|
if (((did_si || can_si_back) && c == '{') || (can_si && c == '}' && inindent(0))) {
|
||||||
|
pos_T old_pos;
|
||||||
|
char *ptr;
|
||||||
|
int i;
|
||||||
|
bool temp;
|
||||||
// for '}' set indent equal to indent of line containing matching '{'
|
// for '}' set indent equal to indent of line containing matching '{'
|
||||||
if (c == '}' && (pos = findmatch(NULL, '{')) != NULL) {
|
if (c == '}' && (pos = findmatch(NULL, '{')) != NULL) {
|
||||||
old_pos = curwin->w_cursor;
|
old_pos = curwin->w_cursor;
|
||||||
|
@@ -724,7 +724,6 @@ sortend:
|
|||||||
/// @return FAIL for failure, OK otherwise
|
/// @return FAIL for failure, OK otherwise
|
||||||
int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
|
int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
|
||||||
{
|
{
|
||||||
char *str;
|
|
||||||
linenr_T l;
|
linenr_T l;
|
||||||
linenr_T extra; // Num lines added before line1
|
linenr_T extra; // Num lines added before line1
|
||||||
linenr_T num_lines; // Num lines moved
|
linenr_T num_lines; // Num lines moved
|
||||||
@@ -761,7 +760,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
for (extra = 0, l = line1; l <= line2; l++) {
|
for (extra = 0, l = line1; l <= line2; l++) {
|
||||||
str = xstrdup(ml_get(l + extra));
|
char *str = xstrdup(ml_get(l + extra));
|
||||||
ml_append(dest + l - line1, str, (colnr_T)0, false);
|
ml_append(dest + l - line1, str, (colnr_T)0, false);
|
||||||
xfree(str);
|
xfree(str);
|
||||||
if (dest < line1) {
|
if (dest < line1) {
|
||||||
@@ -875,10 +874,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
|
|||||||
/// ":copy"
|
/// ":copy"
|
||||||
void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
|
void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
|
||||||
{
|
{
|
||||||
linenr_T count;
|
linenr_T count = line2 - line1 + 1;
|
||||||
char *p;
|
|
||||||
|
|
||||||
count = line2 - line1 + 1;
|
|
||||||
if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0) {
|
if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0) {
|
||||||
curbuf->b_op_start.lnum = n + 1;
|
curbuf->b_op_start.lnum = n + 1;
|
||||||
curbuf->b_op_end.lnum = n + count;
|
curbuf->b_op_end.lnum = n + count;
|
||||||
@@ -902,7 +898,7 @@ void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
|
|||||||
while (line1 <= line2) {
|
while (line1 <= line2) {
|
||||||
// need to use xstrdup() because the line will be unlocked within
|
// need to use xstrdup() because the line will be unlocked within
|
||||||
// ml_append()
|
// ml_append()
|
||||||
p = xstrdup(ml_get(line1));
|
char *p = xstrdup(ml_get(line1));
|
||||||
ml_append(curwin->w_cursor.lnum, p, (colnr_T)0, false);
|
ml_append(curwin->w_cursor.lnum, p, (colnr_T)0, false);
|
||||||
xfree(p);
|
xfree(p);
|
||||||
|
|
||||||
@@ -952,7 +948,6 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
|
|||||||
char *t;
|
char *t;
|
||||||
char *p;
|
char *p;
|
||||||
char *trailarg;
|
char *trailarg;
|
||||||
size_t len;
|
|
||||||
int scroll_save = msg_scroll;
|
int scroll_save = msg_scroll;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -975,7 +970,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
|
|||||||
// Skip leading white space to avoid a strange error with some shells.
|
// Skip leading white space to avoid a strange error with some shells.
|
||||||
trailarg = skipwhite(arg);
|
trailarg = skipwhite(arg);
|
||||||
do {
|
do {
|
||||||
len = strlen(trailarg) + 1;
|
size_t len = strlen(trailarg) + 1;
|
||||||
if (newcmd != NULL) {
|
if (newcmd != NULL) {
|
||||||
len += strlen(newcmd);
|
len += strlen(newcmd);
|
||||||
}
|
}
|
||||||
@@ -2736,7 +2731,6 @@ void ex_append(exarg_T *eap)
|
|||||||
linenr_T lnum = eap->line2;
|
linenr_T lnum = eap->line2;
|
||||||
int indent = 0;
|
int indent = 0;
|
||||||
char *p;
|
char *p;
|
||||||
int vcol;
|
|
||||||
int empty = (curbuf->b_ml.ml_flags & ML_EMPTY);
|
int empty = (curbuf->b_ml.ml_flags & ML_EMPTY);
|
||||||
|
|
||||||
// the ! flag toggles autoindent
|
// the ! flag toggles autoindent
|
||||||
@@ -2803,7 +2797,7 @@ void ex_append(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Look for the "." after automatic indent.
|
// Look for the "." after automatic indent.
|
||||||
vcol = 0;
|
int vcol = 0;
|
||||||
for (p = theline; indent > vcol; p++) {
|
for (p = theline; indent > vcol; p++) {
|
||||||
if (*p == ' ') {
|
if (*p == ' ') {
|
||||||
vcol++;
|
vcol++;
|
||||||
@@ -4339,7 +4333,6 @@ static void global_exe_one(char *const cmd, const linenr_T lnum)
|
|||||||
void ex_global(exarg_T *eap)
|
void ex_global(exarg_T *eap)
|
||||||
{
|
{
|
||||||
linenr_T lnum; // line number according to old situation
|
linenr_T lnum; // line number according to old situation
|
||||||
int ndone = 0;
|
|
||||||
int type; // first char of cmd: 'v' or 'g'
|
int type; // first char of cmd: 'v' or 'g'
|
||||||
char *cmd; // command argument
|
char *cmd; // command argument
|
||||||
|
|
||||||
@@ -4411,6 +4404,7 @@ void ex_global(exarg_T *eap)
|
|||||||
global_exe_one(cmd, lnum);
|
global_exe_one(cmd, lnum);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
int ndone = 0;
|
||||||
// pass 1: set marks for each (not) matching line
|
// pass 1: set marks for each (not) matching line
|
||||||
for (lnum = eap->line1; lnum <= eap->line2 && !got_int; lnum++) {
|
for (lnum = eap->line1; lnum <= eap->line2 && !got_int; lnum++) {
|
||||||
// a match on this line?
|
// a match on this line?
|
||||||
@@ -4687,8 +4681,6 @@ int ex_substitute_preview(exarg_T *eap, long cmdpreview_ns, handle_T cmdpreview_
|
|||||||
/// @return a pointer to the char just past the pattern plus flags.
|
/// @return a pointer to the char just past the pattern plus flags.
|
||||||
char *skip_vimgrep_pat(char *p, char **s, int *flags)
|
char *skip_vimgrep_pat(char *p, char **s, int *flags)
|
||||||
{
|
{
|
||||||
int c;
|
|
||||||
|
|
||||||
if (vim_isIDc((uint8_t)(*p))) {
|
if (vim_isIDc((uint8_t)(*p))) {
|
||||||
// ":vimgrep pattern fname"
|
// ":vimgrep pattern fname"
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
@@ -4703,7 +4695,7 @@ char *skip_vimgrep_pat(char *p, char **s, int *flags)
|
|||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
*s = p + 1;
|
*s = p + 1;
|
||||||
}
|
}
|
||||||
c = (uint8_t)(*p);
|
int c = (uint8_t)(*p);
|
||||||
p = skip_regexp(p + 1, c, true);
|
p = skip_regexp(p + 1, c, true);
|
||||||
if (*p != c) {
|
if (*p != c) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -446,12 +446,9 @@ int buf_write_all(buf_T *buf, int forceit)
|
|||||||
/// ":argdo", ":windo", ":bufdo", ":tabdo", ":cdo", ":ldo", ":cfdo" and ":lfdo"
|
/// ":argdo", ":windo", ":bufdo", ":tabdo", ":cdo", ":ldo", ":cfdo" and ":lfdo"
|
||||||
void ex_listdo(exarg_T *eap)
|
void ex_listdo(exarg_T *eap)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
tabpage_T *tp;
|
tabpage_T *tp;
|
||||||
int next_fnum = 0;
|
|
||||||
char *save_ei = NULL;
|
char *save_ei = NULL;
|
||||||
char *p_shm_save;
|
|
||||||
|
|
||||||
if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo) {
|
if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo) {
|
||||||
// Don't do syntax HL autocommands. Skipping the syntax file is a
|
// Don't do syntax HL autocommands. Skipping the syntax file is a
|
||||||
@@ -469,7 +466,9 @@ void ex_listdo(exarg_T *eap)
|
|||||||
|| !check_changed(curbuf, CCGD_AW
|
|| !check_changed(curbuf, CCGD_AW
|
||||||
| (eap->forceit ? CCGD_FORCEIT : 0)
|
| (eap->forceit ? CCGD_FORCEIT : 0)
|
||||||
| CCGD_EXCMD)) {
|
| CCGD_EXCMD)) {
|
||||||
i = 0;
|
int next_fnum = 0;
|
||||||
|
char *p_shm_save;
|
||||||
|
int i = 0;
|
||||||
// start at the eap->line1 argument/window/buffer
|
// start at the eap->line1 argument/window/buffer
|
||||||
wp = firstwin;
|
wp = firstwin;
|
||||||
tp = first_tabpage;
|
tp = first_tabpage;
|
||||||
@@ -762,14 +761,13 @@ void ex_compiler(exarg_T *eap)
|
|||||||
/// ":checktime [buffer]"
|
/// ":checktime [buffer]"
|
||||||
void ex_checktime(exarg_T *eap)
|
void ex_checktime(exarg_T *eap)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
int save_no_check_timestamps = no_check_timestamps;
|
int save_no_check_timestamps = no_check_timestamps;
|
||||||
|
|
||||||
no_check_timestamps = 0;
|
no_check_timestamps = 0;
|
||||||
if (eap->addr_count == 0) { // default is all buffers
|
if (eap->addr_count == 0) { // default is all buffers
|
||||||
check_timestamps(false);
|
check_timestamps(false);
|
||||||
} else {
|
} else {
|
||||||
buf = buflist_findnr((int)eap->line2);
|
buf_T *buf = buflist_findnr((int)eap->line2);
|
||||||
if (buf != NULL) { // cannot happen?
|
if (buf != NULL) { // cannot happen?
|
||||||
(void)buf_check_timestamp(buf);
|
(void)buf_check_timestamp(buf);
|
||||||
}
|
}
|
||||||
|
@@ -278,9 +278,8 @@ bool cause_errthrow(const char *mesg, bool severe, bool *ignore)
|
|||||||
/// Free a "msg_list" and the messages it contains.
|
/// Free a "msg_list" and the messages it contains.
|
||||||
static void free_msglist(msglist_T *l)
|
static void free_msglist(msglist_T *l)
|
||||||
{
|
{
|
||||||
msglist_T *messages, *next;
|
msglist_T *next;
|
||||||
|
msglist_T *messages = l;
|
||||||
messages = l;
|
|
||||||
while (messages != NULL) {
|
while (messages != NULL) {
|
||||||
next = messages->next;
|
next = messages->next;
|
||||||
xfree(messages->msg);
|
xfree(messages->msg);
|
||||||
@@ -379,9 +378,10 @@ int do_intthrow(cstack_T *cstack)
|
|||||||
char *get_exception_string(void *value, except_type_T type, char *cmdname, int *should_free)
|
char *get_exception_string(void *value, except_type_T type, char *cmdname, int *should_free)
|
||||||
{
|
{
|
||||||
char *ret, *mesg;
|
char *ret, *mesg;
|
||||||
char *p, *val;
|
|
||||||
|
|
||||||
if (type == ET_ERROR) {
|
if (type == ET_ERROR) {
|
||||||
|
char *p;
|
||||||
|
char *val;
|
||||||
*should_free = true;
|
*should_free = true;
|
||||||
mesg = ((msglist_T *)value)->throw_msg;
|
mesg = ((msglist_T *)value)->throw_msg;
|
||||||
if (cmdname != NULL && *cmdname != NUL) {
|
if (cmdname != NULL && *cmdname != NUL) {
|
||||||
@@ -441,9 +441,6 @@ char *get_exception_string(void *value, except_type_T type, char *cmdname, int *
|
|||||||
/// exception.
|
/// exception.
|
||||||
static int throw_exception(void *value, except_type_T type, char *cmdname)
|
static int throw_exception(void *value, except_type_T type, char *cmdname)
|
||||||
{
|
{
|
||||||
except_T *excp;
|
|
||||||
int should_free;
|
|
||||||
|
|
||||||
// Disallow faking Interrupt or error exceptions as user exceptions. They
|
// Disallow faking Interrupt or error exceptions as user exceptions. They
|
||||||
// would be treated differently from real interrupt or error exceptions
|
// would be treated differently from real interrupt or error exceptions
|
||||||
// when no active try block is found, see do_cmdline().
|
// when no active try block is found, see do_cmdline().
|
||||||
@@ -456,7 +453,7 @@ static int throw_exception(void *value, except_type_T type, char *cmdname)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
excp = xmalloc(sizeof(except_T));
|
except_T *excp = xmalloc(sizeof(except_T));
|
||||||
|
|
||||||
if (type == ET_ERROR) {
|
if (type == ET_ERROR) {
|
||||||
// Store the original message and prefix the exception value with
|
// Store the original message and prefix the exception value with
|
||||||
@@ -464,6 +461,7 @@ static int throw_exception(void *value, except_type_T type, char *cmdname)
|
|||||||
excp->messages = (msglist_T *)value;
|
excp->messages = (msglist_T *)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int should_free;
|
||||||
excp->value = get_exception_string(value, type, cmdname, &should_free);
|
excp->value = get_exception_string(value, type, cmdname, &should_free);
|
||||||
if (excp->value == NULL && should_free) {
|
if (excp->value == NULL && should_free) {
|
||||||
goto nomem;
|
goto nomem;
|
||||||
@@ -525,8 +523,6 @@ fail:
|
|||||||
/// caught and the catch clause has been ended normally.
|
/// caught and the catch clause has been ended normally.
|
||||||
static void discard_exception(except_T *excp, bool was_finished)
|
static void discard_exception(except_T *excp, bool was_finished)
|
||||||
{
|
{
|
||||||
char *saved_IObuff;
|
|
||||||
|
|
||||||
if (current_exception == excp) {
|
if (current_exception == excp) {
|
||||||
current_exception = NULL;
|
current_exception = NULL;
|
||||||
}
|
}
|
||||||
@@ -538,7 +534,7 @@ static void discard_exception(except_T *excp, bool was_finished)
|
|||||||
if (p_verbose >= 13 || debug_break_level > 0) {
|
if (p_verbose >= 13 || debug_break_level > 0) {
|
||||||
int save_msg_silent = msg_silent;
|
int save_msg_silent = msg_silent;
|
||||||
|
|
||||||
saved_IObuff = xstrdup(IObuff);
|
char *saved_IObuff = xstrdup(IObuff);
|
||||||
if (debug_break_level > 0) {
|
if (debug_break_level > 0) {
|
||||||
msg_silent = false; // display messages
|
msg_silent = false; // display messages
|
||||||
} else {
|
} else {
|
||||||
@@ -677,7 +673,6 @@ static void report_pending(int action, int pending, void *value)
|
|||||||
{
|
{
|
||||||
char *mesg;
|
char *mesg;
|
||||||
char *s;
|
char *s;
|
||||||
int save_msg_silent;
|
|
||||||
|
|
||||||
assert(value || !(pending & CSTP_THROW));
|
assert(value || !(pending & CSTP_THROW));
|
||||||
|
|
||||||
@@ -727,7 +722,7 @@ static void report_pending(int action, int pending, void *value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
save_msg_silent = msg_silent;
|
int save_msg_silent = msg_silent;
|
||||||
if (debug_break_level > 0) {
|
if (debug_break_level > 0) {
|
||||||
msg_silent = false; // display messages
|
msg_silent = false; // display messages
|
||||||
}
|
}
|
||||||
@@ -806,8 +801,6 @@ void ex_eval(exarg_T *eap)
|
|||||||
/// Handle ":if".
|
/// Handle ":if".
|
||||||
void ex_if(exarg_T *eap)
|
void ex_if(exarg_T *eap)
|
||||||
{
|
{
|
||||||
int skip;
|
|
||||||
int result;
|
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
|
|
||||||
if (cstack->cs_idx == CSTACK_LEN - 1) {
|
if (cstack->cs_idx == CSTACK_LEN - 1) {
|
||||||
@@ -816,10 +809,10 @@ void ex_if(exarg_T *eap)
|
|||||||
cstack->cs_idx++;
|
cstack->cs_idx++;
|
||||||
cstack->cs_flags[cstack->cs_idx] = 0;
|
cstack->cs_flags[cstack->cs_idx] = 0;
|
||||||
|
|
||||||
skip = CHECK_SKIP;
|
int skip = CHECK_SKIP;
|
||||||
|
|
||||||
bool error;
|
bool error;
|
||||||
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
|
int result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
|
||||||
|
|
||||||
if (!skip && !error) {
|
if (!skip && !error) {
|
||||||
if (result) {
|
if (result) {
|
||||||
@@ -860,7 +853,6 @@ void ex_endif(exarg_T *eap)
|
|||||||
/// Handle ":else" and ":elseif".
|
/// Handle ":else" and ":elseif".
|
||||||
void ex_else(exarg_T *eap)
|
void ex_else(exarg_T *eap)
|
||||||
{
|
{
|
||||||
bool result = false;
|
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
|
|
||||||
bool skip = CHECK_SKIP;
|
bool skip = CHECK_SKIP;
|
||||||
@@ -907,6 +899,7 @@ void ex_else(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_elseif) {
|
if (eap->cmdidx == CMD_elseif) {
|
||||||
|
bool result = false;
|
||||||
bool error;
|
bool error;
|
||||||
// When skipping we ignore most errors, but a missing expression is
|
// When skipping we ignore most errors, but a missing expression is
|
||||||
// wrong, perhaps it should have been "else".
|
// wrong, perhaps it should have been "else".
|
||||||
@@ -941,13 +934,12 @@ void ex_else(exarg_T *eap)
|
|||||||
void ex_while(exarg_T *eap)
|
void ex_while(exarg_T *eap)
|
||||||
{
|
{
|
||||||
bool error;
|
bool error;
|
||||||
int skip;
|
|
||||||
int result;
|
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
|
|
||||||
if (cstack->cs_idx == CSTACK_LEN - 1) {
|
if (cstack->cs_idx == CSTACK_LEN - 1) {
|
||||||
eap->errmsg = _("E585: :while/:for nesting too deep");
|
eap->errmsg = _("E585: :while/:for nesting too deep");
|
||||||
} else {
|
} else {
|
||||||
|
int result;
|
||||||
// The loop flag is set when we have jumped back from the matching
|
// The loop flag is set when we have jumped back from the matching
|
||||||
// ":endwhile" or ":endfor". When not set, need to initialise this
|
// ":endwhile" or ":endfor". When not set, need to initialise this
|
||||||
// cstack entry.
|
// cstack entry.
|
||||||
@@ -959,7 +951,7 @@ void ex_while(exarg_T *eap)
|
|||||||
cstack->cs_flags[cstack->cs_idx] =
|
cstack->cs_flags[cstack->cs_idx] =
|
||||||
eap->cmdidx == CMD_while ? CSF_WHILE : CSF_FOR;
|
eap->cmdidx == CMD_while ? CSF_WHILE : CSF_FOR;
|
||||||
|
|
||||||
skip = CHECK_SKIP;
|
int skip = CHECK_SKIP;
|
||||||
if (eap->cmdidx == CMD_while) {
|
if (eap->cmdidx == CMD_while) {
|
||||||
// ":while bool-expr"
|
// ":while bool-expr"
|
||||||
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
|
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
|
||||||
@@ -1013,7 +1005,6 @@ void ex_while(exarg_T *eap)
|
|||||||
/// Handle ":continue"
|
/// Handle ":continue"
|
||||||
void ex_continue(exarg_T *eap)
|
void ex_continue(exarg_T *eap)
|
||||||
{
|
{
|
||||||
int idx;
|
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
|
|
||||||
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
|
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
|
||||||
@@ -1023,7 +1014,7 @@ void ex_continue(exarg_T *eap)
|
|||||||
// conditional not in its finally clause (which is then to be executed
|
// conditional not in its finally clause (which is then to be executed
|
||||||
// next). Therefore, deactivate all conditionals except the ":while"
|
// next). Therefore, deactivate all conditionals except the ":while"
|
||||||
// itself (if reached).
|
// itself (if reached).
|
||||||
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, false);
|
int idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, false);
|
||||||
assert(idx >= 0);
|
assert(idx >= 0);
|
||||||
if (cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR)) {
|
if (cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR)) {
|
||||||
rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel);
|
rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel);
|
||||||
@@ -1043,7 +1034,6 @@ void ex_continue(exarg_T *eap)
|
|||||||
/// Handle ":break"
|
/// Handle ":break"
|
||||||
void ex_break(exarg_T *eap)
|
void ex_break(exarg_T *eap)
|
||||||
{
|
{
|
||||||
int idx;
|
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
|
|
||||||
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
|
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
|
||||||
@@ -1053,7 +1043,7 @@ void ex_break(exarg_T *eap)
|
|||||||
// conditional not in its finally clause (which is then to be
|
// conditional not in its finally clause (which is then to be
|
||||||
// executed next) is found. In the latter case, make the ":break"
|
// executed next) is found. In the latter case, make the ":break"
|
||||||
// pending for execution at the ":endtry".
|
// pending for execution at the ":endtry".
|
||||||
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, true);
|
int idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, true);
|
||||||
if (idx >= 0 && !(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) {
|
if (idx >= 0 && !(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) {
|
||||||
cstack->cs_pending[idx] = CSTP_BREAK;
|
cstack->cs_pending[idx] = CSTP_BREAK;
|
||||||
report_make_pending(CSTP_BREAK, NULL);
|
report_make_pending(CSTP_BREAK, NULL);
|
||||||
@@ -1065,10 +1055,8 @@ void ex_break(exarg_T *eap)
|
|||||||
void ex_endwhile(exarg_T *eap)
|
void ex_endwhile(exarg_T *eap)
|
||||||
{
|
{
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
int idx;
|
|
||||||
char *err;
|
char *err;
|
||||||
int csf;
|
int csf;
|
||||||
int fl;
|
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_endwhile) {
|
if (eap->cmdidx == CMD_endwhile) {
|
||||||
err = e_while;
|
err = e_while;
|
||||||
@@ -1081,7 +1069,7 @@ void ex_endwhile(exarg_T *eap)
|
|||||||
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
|
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
|
||||||
eap->errmsg = _(err);
|
eap->errmsg = _(err);
|
||||||
} else {
|
} else {
|
||||||
fl = cstack->cs_flags[cstack->cs_idx];
|
int fl = cstack->cs_flags[cstack->cs_idx];
|
||||||
if (!(fl & csf)) {
|
if (!(fl & csf)) {
|
||||||
// If we are in a ":while" or ":for" but used the wrong endloop
|
// If we are in a ":while" or ":for" but used the wrong endloop
|
||||||
// command, do not rewind to the next enclosing ":for"/":while".
|
// command, do not rewind to the next enclosing ":for"/":while".
|
||||||
@@ -1098,6 +1086,7 @@ void ex_endwhile(exarg_T *eap)
|
|||||||
eap->errmsg = _(e_endtry);
|
eap->errmsg = _(e_endtry);
|
||||||
}
|
}
|
||||||
// Try to find the matching ":while" and report what's missing.
|
// Try to find the matching ":while" and report what's missing.
|
||||||
|
int idx;
|
||||||
for (idx = cstack->cs_idx; idx > 0; idx--) {
|
for (idx = cstack->cs_idx; idx > 0; idx--) {
|
||||||
fl = cstack->cs_flags[idx];
|
fl = cstack->cs_flags[idx];
|
||||||
if ((fl & CSF_TRY) && !(fl & CSF_FINALLY)) {
|
if ((fl & CSF_TRY) && !(fl & CSF_FINALLY)) {
|
||||||
@@ -1163,7 +1152,6 @@ void ex_throw(exarg_T *eap)
|
|||||||
/// used for rethrowing an uncaught exception.
|
/// used for rethrowing an uncaught exception.
|
||||||
void do_throw(cstack_T *cstack)
|
void do_throw(cstack_T *cstack)
|
||||||
{
|
{
|
||||||
int idx;
|
|
||||||
int inactivate_try = false;
|
int inactivate_try = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1187,7 +1175,7 @@ void do_throw(cstack_T *cstack)
|
|||||||
got_int = false;
|
got_int = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
idx = cleanup_conditionals(cstack, 0, inactivate_try);
|
int idx = cleanup_conditionals(cstack, 0, inactivate_try);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
// If this try conditional is active and we are before its first
|
// If this try conditional is active and we are before its first
|
||||||
// ":catch", set THROWN so that the ":catch" commands will check
|
// ":catch", set THROWN so that the ":catch" commands will check
|
||||||
@@ -1220,7 +1208,6 @@ void do_throw(cstack_T *cstack)
|
|||||||
/// Handle ":try"
|
/// Handle ":try"
|
||||||
void ex_try(exarg_T *eap)
|
void ex_try(exarg_T *eap)
|
||||||
{
|
{
|
||||||
int skip;
|
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
|
|
||||||
if (cstack->cs_idx == CSTACK_LEN - 1) {
|
if (cstack->cs_idx == CSTACK_LEN - 1) {
|
||||||
@@ -1231,7 +1218,7 @@ void ex_try(exarg_T *eap)
|
|||||||
cstack->cs_flags[cstack->cs_idx] = CSF_TRY;
|
cstack->cs_flags[cstack->cs_idx] = CSF_TRY;
|
||||||
cstack->cs_pending[cstack->cs_idx] = CSTP_NONE;
|
cstack->cs_pending[cstack->cs_idx] = CSTP_NONE;
|
||||||
|
|
||||||
skip = CHECK_SKIP;
|
int skip = CHECK_SKIP;
|
||||||
|
|
||||||
if (!skip) {
|
if (!skip) {
|
||||||
// Set ACTIVE and TRUE. TRUE means that the corresponding ":catch"
|
// Set ACTIVE and TRUE. TRUE means that the corresponding ":catch"
|
||||||
@@ -1271,12 +1258,9 @@ void ex_catch(exarg_T *eap)
|
|||||||
int idx = 0;
|
int idx = 0;
|
||||||
bool give_up = false;
|
bool give_up = false;
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
bool caught = false;
|
|
||||||
char *end;
|
char *end;
|
||||||
char save_char = 0;
|
|
||||||
char *save_cpo;
|
char *save_cpo;
|
||||||
regmatch_T regmatch;
|
regmatch_T regmatch;
|
||||||
int prev_got_int;
|
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
char *pat;
|
char *pat;
|
||||||
|
|
||||||
@@ -1319,6 +1303,7 @@ void ex_catch(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!give_up) {
|
if (!give_up) {
|
||||||
|
bool caught = false;
|
||||||
// Don't do something when no exception has been thrown or when the
|
// Don't do something when no exception has been thrown or when the
|
||||||
// corresponding try block never got active (because of an inactive
|
// corresponding try block never got active (because of an inactive
|
||||||
// surrounding conditional or after an error or interrupt or throw).
|
// surrounding conditional or after an error or interrupt or throw).
|
||||||
@@ -1344,6 +1329,7 @@ void ex_catch(exarg_T *eap)
|
|||||||
// the original exception, replace it by an interrupt exception,
|
// the original exception, replace it by an interrupt exception,
|
||||||
// and don't catch it in this try block.
|
// and don't catch it in this try block.
|
||||||
if (!dbg_check_skipped(eap) || !do_intthrow(cstack)) {
|
if (!dbg_check_skipped(eap) || !do_intthrow(cstack)) {
|
||||||
|
char save_char = 0;
|
||||||
// Terminate the pattern and avoid the 'l' flag in 'cpoptions'
|
// Terminate the pattern and avoid the 'l' flag in 'cpoptions'
|
||||||
// while compiling it.
|
// while compiling it.
|
||||||
if (end != NULL) {
|
if (end != NULL) {
|
||||||
@@ -1365,12 +1351,11 @@ void ex_catch(exarg_T *eap)
|
|||||||
if (regmatch.regprog == NULL) {
|
if (regmatch.regprog == NULL) {
|
||||||
semsg(_(e_invarg2), pat);
|
semsg(_(e_invarg2), pat);
|
||||||
} else {
|
} else {
|
||||||
//
|
|
||||||
// Save the value of got_int and reset it. We don't want
|
// Save the value of got_int and reset it. We don't want
|
||||||
// a previous interruption cancel matching, only hitting
|
// a previous interruption cancel matching, only hitting
|
||||||
// CTRL-C while matching should abort it.
|
// CTRL-C while matching should abort it.
|
||||||
//
|
|
||||||
prev_got_int = got_int;
|
int prev_got_int = got_int;
|
||||||
got_int = false;
|
got_int = false;
|
||||||
caught = vim_regexec_nl(®match, current_exception->value, (colnr_T)0);
|
caught = vim_regexec_nl(®match, current_exception->value, (colnr_T)0);
|
||||||
got_int |= prev_got_int;
|
got_int |= prev_got_int;
|
||||||
@@ -1415,7 +1400,6 @@ void ex_catch(exarg_T *eap)
|
|||||||
void ex_finally(exarg_T *eap)
|
void ex_finally(exarg_T *eap)
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
int skip = false;
|
|
||||||
int pending = CSTP_NONE;
|
int pending = CSTP_NONE;
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
|
|
||||||
@@ -1451,7 +1435,7 @@ void ex_finally(exarg_T *eap)
|
|||||||
// ":finally". After every other error (did_emsg or the conditional
|
// ":finally". After every other error (did_emsg or the conditional
|
||||||
// errors detected above) or after an interrupt (got_int) or an
|
// errors detected above) or after an interrupt (got_int) or an
|
||||||
// exception (did_throw), the finally clause must be executed.
|
// exception (did_throw), the finally clause must be executed.
|
||||||
skip = !(cstack->cs_flags[cstack->cs_idx] & CSF_TRUE);
|
int skip = !(cstack->cs_flags[cstack->cs_idx] & CSF_TRUE);
|
||||||
|
|
||||||
if (!skip) {
|
if (!skip) {
|
||||||
// When debugging or a breakpoint was encountered, display the
|
// When debugging or a breakpoint was encountered, display the
|
||||||
@@ -1985,14 +1969,12 @@ void ex_endfunction(exarg_T *eap)
|
|||||||
/// @return true if the string "p" looks like a ":while" or ":for" command.
|
/// @return true if the string "p" looks like a ":while" or ":for" command.
|
||||||
int has_loop_cmd(char *p)
|
int has_loop_cmd(char *p)
|
||||||
{
|
{
|
||||||
int len;
|
|
||||||
|
|
||||||
// skip modifiers, white space and ':'
|
// skip modifiers, white space and ':'
|
||||||
for (;;) {
|
for (;;) {
|
||||||
while (*p == ' ' || *p == '\t' || *p == ':') {
|
while (*p == ' ' || *p == '\t' || *p == ':') {
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
len = modifier_len(p);
|
int len = modifier_len(p);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -1729,7 +1729,6 @@ static int command_line_browse_history(CommandLineState *s)
|
|||||||
if (s->hiscnt != s->save_hiscnt) {
|
if (s->hiscnt != s->save_hiscnt) {
|
||||||
// jumped to other entry
|
// jumped to other entry
|
||||||
char *p;
|
char *p;
|
||||||
int len = 0;
|
|
||||||
int old_firstc;
|
int old_firstc;
|
||||||
|
|
||||||
XFREE_CLEAR(ccline.cmdbuff);
|
XFREE_CLEAR(ccline.cmdbuff);
|
||||||
@@ -1743,6 +1742,7 @@ static int command_line_browse_history(CommandLineState *s)
|
|||||||
if (s->histype == HIST_SEARCH
|
if (s->histype == HIST_SEARCH
|
||||||
&& p != s->lookfor
|
&& p != s->lookfor
|
||||||
&& (old_firstc = (uint8_t)p[strlen(p) + 1]) != s->firstc) {
|
&& (old_firstc = (uint8_t)p[strlen(p) + 1]) != s->firstc) {
|
||||||
|
int len = 0;
|
||||||
// Correct for the separator character used when
|
// Correct for the separator character used when
|
||||||
// adding the history entry vs the one used now.
|
// adding the history entry vs the one used now.
|
||||||
// First loop: count length.
|
// First loop: count length.
|
||||||
@@ -3676,7 +3676,6 @@ static void restore_cmdline(CmdlineInfo *ccp)
|
|||||||
static bool cmdline_paste(int regname, bool literally, bool remcr)
|
static bool cmdline_paste(int regname, bool literally, bool remcr)
|
||||||
{
|
{
|
||||||
char *arg;
|
char *arg;
|
||||||
char *p;
|
|
||||||
bool allocated;
|
bool allocated;
|
||||||
|
|
||||||
// check for valid regname; also accept special characters for CTRL-R in
|
// check for valid regname; also accept special characters for CTRL-R in
|
||||||
@@ -3708,7 +3707,7 @@ static bool cmdline_paste(int regname, bool literally, bool remcr)
|
|||||||
|
|
||||||
// When 'incsearch' is set and CTRL-R CTRL-W used: skip the duplicate
|
// When 'incsearch' is set and CTRL-R CTRL-W used: skip the duplicate
|
||||||
// part of the word.
|
// part of the word.
|
||||||
p = arg;
|
char *p = arg;
|
||||||
if (p_is && regname == Ctrl_W) {
|
if (p_is && regname == Ctrl_W) {
|
||||||
char *w;
|
char *w;
|
||||||
int len;
|
int len;
|
||||||
@@ -3743,17 +3742,15 @@ static bool cmdline_paste(int regname, bool literally, bool remcr)
|
|||||||
// line.
|
// line.
|
||||||
void cmdline_paste_str(char *s, int literally)
|
void cmdline_paste_str(char *s, int literally)
|
||||||
{
|
{
|
||||||
int c, cv;
|
|
||||||
|
|
||||||
if (literally) {
|
if (literally) {
|
||||||
put_on_cmdline(s, -1, true);
|
put_on_cmdline(s, -1, true);
|
||||||
} else {
|
} else {
|
||||||
while (*s != NUL) {
|
while (*s != NUL) {
|
||||||
cv = (uint8_t)(*s);
|
int cv = (uint8_t)(*s);
|
||||||
if (cv == Ctrl_V && s[1]) {
|
if (cv == Ctrl_V && s[1]) {
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
c = mb_cptr2char_adv((const char **)&s);
|
int c = mb_cptr2char_adv((const char **)&s);
|
||||||
if (cv == Ctrl_V || c == ESC || c == Ctrl_C
|
if (cv == Ctrl_V || c == ESC || c == Ctrl_C
|
||||||
|| c == CAR || c == NL || c == Ctrl_L
|
|| c == CAR || c == NL || c == Ctrl_L
|
||||||
|| (c == Ctrl_BSL && *s == Ctrl_N)) {
|
|| (c == Ctrl_BSL && *s == Ctrl_N)) {
|
||||||
@@ -3781,8 +3778,6 @@ void redrawcmdline(void)
|
|||||||
|
|
||||||
static void redrawcmdprompt(void)
|
static void redrawcmdprompt(void)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
if (cmd_silent) {
|
if (cmd_silent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3801,7 +3796,7 @@ static void redrawcmdprompt(void)
|
|||||||
ccline.cmdindent--;
|
ccline.cmdindent--;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = ccline.cmdindent; i > 0; i--) {
|
for (int i = ccline.cmdindent; i > 0; i--) {
|
||||||
msg_putchar(' ');
|
msg_putchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4284,12 +4279,10 @@ void cmdline_init(void)
|
|||||||
/// Returns NULL if value is OK, error message otherwise.
|
/// Returns NULL if value is OK, error message otherwise.
|
||||||
char *check_cedit(void)
|
char *check_cedit(void)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
|
|
||||||
if (*p_cedit == NUL) {
|
if (*p_cedit == NUL) {
|
||||||
cedit_key = -1;
|
cedit_key = -1;
|
||||||
} else {
|
} else {
|
||||||
n = string_to_key(p_cedit);
|
int n = string_to_key(p_cedit);
|
||||||
if (vim_isprintc(n)) {
|
if (vim_isprintc(n)) {
|
||||||
return e_invarg;
|
return e_invarg;
|
||||||
}
|
}
|
||||||
@@ -4309,9 +4302,7 @@ static int open_cmdwin(void)
|
|||||||
bufref_T old_curbuf;
|
bufref_T old_curbuf;
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
win_T *old_curwin = curwin;
|
win_T *old_curwin = curwin;
|
||||||
win_T *wp;
|
|
||||||
int i;
|
int i;
|
||||||
linenr_T lnum;
|
|
||||||
garray_T winsizes;
|
garray_T winsizes;
|
||||||
char typestr[2];
|
char typestr[2];
|
||||||
int save_restart_edit = restart_edit;
|
int save_restart_edit = restart_edit;
|
||||||
@@ -4392,7 +4383,7 @@ static int open_cmdwin(void)
|
|||||||
if (get_hislen() > 0 && histtype != HIST_INVALID) {
|
if (get_hislen() > 0 && histtype != HIST_INVALID) {
|
||||||
i = *get_hisidx(histtype);
|
i = *get_hisidx(histtype);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
lnum = 0;
|
linenr_T lnum = 0;
|
||||||
do {
|
do {
|
||||||
if (++i == get_hislen()) {
|
if (++i == get_hislen()) {
|
||||||
i = 0;
|
i = 0;
|
||||||
@@ -4463,6 +4454,7 @@ static int open_cmdwin(void)
|
|||||||
cmdwin_result = Ctrl_C;
|
cmdwin_result = Ctrl_C;
|
||||||
emsg(_("E199: Active window or buffer deleted"));
|
emsg(_("E199: Active window or buffer deleted"));
|
||||||
} else {
|
} else {
|
||||||
|
win_T *wp;
|
||||||
// autocmds may abort script processing
|
// autocmds may abort script processing
|
||||||
if (aborting() && cmdwin_result != K_IGNORE) {
|
if (aborting() && cmdwin_result != K_IGNORE) {
|
||||||
cmdwin_result = Ctrl_C;
|
cmdwin_result = Ctrl_C;
|
||||||
|
@@ -65,10 +65,10 @@ static int put_view_curpos(FILE *fd, const win_T *wp, char *spaces)
|
|||||||
|
|
||||||
static int ses_winsizes(FILE *fd, int restore_size, win_T *tab_firstwin)
|
static int ses_winsizes(FILE *fd, int restore_size, win_T *tab_firstwin)
|
||||||
{
|
{
|
||||||
int n = 0;
|
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
|
|
||||||
if (restore_size && (ssop_flags & SSOP_WINSIZE)) {
|
if (restore_size && (ssop_flags & SSOP_WINSIZE)) {
|
||||||
|
int n = 0;
|
||||||
for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
|
for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
|
||||||
if (!ses_do_win(wp)) {
|
if (!ses_do_win(wp)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -218,14 +218,13 @@ static int ses_do_win(win_T *wp)
|
|||||||
static int ses_arglist(FILE *fd, char *cmd, garray_T *gap, int fullname, unsigned *flagp)
|
static int ses_arglist(FILE *fd, char *cmd, garray_T *gap, int fullname, unsigned *flagp)
|
||||||
{
|
{
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
char *s;
|
|
||||||
|
|
||||||
if (fprintf(fd, "%s\n%s\n", cmd, "%argdel") < 0) {
|
if (fprintf(fd, "%s\n%s\n", cmd, "%argdel") < 0) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < gap->ga_len; i++) {
|
for (int i = 0; i < gap->ga_len; i++) {
|
||||||
// NULL file names are skipped (only happens when out of memory).
|
// NULL file names are skipped (only happens when out of memory).
|
||||||
s = alist_name(&((aentry_T *)gap->ga_data)[i]);
|
char *s = alist_name(&((aentry_T *)gap->ga_data)[i]);
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
if (fullname) {
|
if (fullname) {
|
||||||
buf = xmalloc(MAXPATHL);
|
buf = xmalloc(MAXPATHL);
|
||||||
@@ -551,7 +550,6 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
|
|||||||
static int makeopens(FILE *fd, char *dirnow)
|
static int makeopens(FILE *fd, char *dirnow)
|
||||||
{
|
{
|
||||||
int only_save_windows = true;
|
int only_save_windows = true;
|
||||||
int nr;
|
|
||||||
int restore_size = true;
|
int restore_size = true;
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
char *sname;
|
char *sname;
|
||||||
@@ -753,11 +751,9 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
PUTLINE_FAIL("let &splitright = s:save_splitright");
|
PUTLINE_FAIL("let &splitright = s:save_splitright");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Check if window sizes can be restored (no windows omitted).
|
// Check if window sizes can be restored (no windows omitted).
|
||||||
// Remember the window number of the current window after restoring.
|
// Remember the window number of the current window after restoring.
|
||||||
//
|
int nr = 0;
|
||||||
nr = 0;
|
|
||||||
for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
|
for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
|
||||||
if (ses_do_win(wp)) {
|
if (ses_do_win(wp)) {
|
||||||
nr++;
|
nr++;
|
||||||
@@ -927,11 +923,9 @@ void ex_loadview(exarg_T *eap)
|
|||||||
void ex_mkrc(exarg_T *eap)
|
void ex_mkrc(exarg_T *eap)
|
||||||
{
|
{
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
int failed = false;
|
|
||||||
int view_session = false; // :mkview, :mksession
|
int view_session = false; // :mkview, :mksession
|
||||||
int using_vdir = false; // using 'viewdir'?
|
int using_vdir = false; // using 'viewdir'?
|
||||||
char *viewFile = NULL;
|
char *viewFile = NULL;
|
||||||
unsigned *flagp;
|
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_mksession || eap->cmdidx == CMD_mkview) {
|
if (eap->cmdidx == CMD_mksession || eap->cmdidx == CMD_mkview) {
|
||||||
view_session = true;
|
view_session = true;
|
||||||
@@ -970,6 +964,8 @@ void ex_mkrc(exarg_T *eap)
|
|||||||
|
|
||||||
fd = open_exfile(fname, eap->forceit, WRITEBIN);
|
fd = open_exfile(fname, eap->forceit, WRITEBIN);
|
||||||
if (fd != NULL) {
|
if (fd != NULL) {
|
||||||
|
int failed = false;
|
||||||
|
unsigned *flagp;
|
||||||
if (eap->cmdidx == CMD_mkview) {
|
if (eap->cmdidx == CMD_mkview) {
|
||||||
flagp = &vop_flags;
|
flagp = &vop_flags;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1026,8 +1026,6 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char *filename,
|
|||||||
static bool ff_wc_equal(char *s1, char *s2)
|
static bool ff_wc_equal(char *s1, char *s2)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int c1 = NUL;
|
|
||||||
int c2 = NUL;
|
|
||||||
int prev1 = NUL;
|
int prev1 = NUL;
|
||||||
int prev2 = NUL;
|
int prev2 = NUL;
|
||||||
|
|
||||||
@@ -1040,8 +1038,8 @@ static bool ff_wc_equal(char *s1, char *s2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;) {
|
for (i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;) {
|
||||||
c1 = utf_ptr2char(s1 + i);
|
int c1 = utf_ptr2char(s1 + i);
|
||||||
c2 = utf_ptr2char(s2 + j);
|
int c2 = utf_ptr2char(s2 + j);
|
||||||
|
|
||||||
if ((p_fic ? mb_tolower(c1) != mb_tolower(c2) : c1 != c2)
|
if ((p_fic ? mb_tolower(c1) != mb_tolower(c2) : c1 != c2)
|
||||||
&& (prev1 != '*' || prev2 != '*')) {
|
&& (prev1 != '*' || prev2 != '*')) {
|
||||||
|
@@ -155,7 +155,6 @@ static char *get_buffcont(buffheader_T *buffer, int dozero)
|
|||||||
{
|
{
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
char *p2;
|
|
||||||
|
|
||||||
// compute the total length of the string
|
// compute the total length of the string
|
||||||
for (const buffblock_T *bp = buffer->bh_first.b_next;
|
for (const buffblock_T *bp = buffer->bh_first.b_next;
|
||||||
@@ -165,7 +164,7 @@ static char *get_buffcont(buffheader_T *buffer, int dozero)
|
|||||||
|
|
||||||
if (count || dozero) {
|
if (count || dozero) {
|
||||||
p = xmalloc(count + 1);
|
p = xmalloc(count + 1);
|
||||||
p2 = p;
|
char *p2 = p;
|
||||||
for (const buffblock_T *bp = buffer->bh_first.b_next;
|
for (const buffblock_T *bp = buffer->bh_first.b_next;
|
||||||
bp != NULL; bp = bp->b_next) {
|
bp != NULL; bp = bp->b_next) {
|
||||||
for (const char *str = bp->b_str; *str;) {
|
for (const char *str = bp->b_str; *str;) {
|
||||||
@@ -1020,8 +1019,6 @@ int typebuf_maplen(void)
|
|||||||
// remove "len" characters from typebuf.tb_buf[typebuf.tb_off + offset]
|
// remove "len" characters from typebuf.tb_buf[typebuf.tb_off + offset]
|
||||||
void del_typebuf(int len, int offset)
|
void del_typebuf(int len, int offset)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
}
|
}
|
||||||
@@ -1034,7 +1031,7 @@ void del_typebuf(int len, int offset)
|
|||||||
typebuf.tb_off += len;
|
typebuf.tb_off += len;
|
||||||
} else {
|
} else {
|
||||||
// Have to move the characters in typebuf.tb_buf[] and typebuf.tb_noremap[]
|
// Have to move the characters in typebuf.tb_buf[] and typebuf.tb_noremap[]
|
||||||
i = typebuf.tb_off + offset;
|
int i = typebuf.tb_off + offset;
|
||||||
// Leave some extra room at the end to avoid reallocation.
|
// Leave some extra room at the end to avoid reallocation.
|
||||||
if (typebuf.tb_off > MAXMAPLEN) {
|
if (typebuf.tb_off > MAXMAPLEN) {
|
||||||
memmove(typebuf.tb_buf + MAXMAPLEN,
|
memmove(typebuf.tb_buf + MAXMAPLEN,
|
||||||
@@ -1408,10 +1405,8 @@ int merge_modifiers(int c_arg, int *modifiers)
|
|||||||
/// Returns the modifiers in the global "mod_mask".
|
/// Returns the modifiers in the global "mod_mask".
|
||||||
int vgetc(void)
|
int vgetc(void)
|
||||||
{
|
{
|
||||||
int c, c2;
|
int c;
|
||||||
int n;
|
|
||||||
char_u buf[MB_MAXBYTES + 1];
|
char_u buf[MB_MAXBYTES + 1];
|
||||||
int i;
|
|
||||||
|
|
||||||
// Do garbage collection when garbagecollect() was called previously and
|
// Do garbage collection when garbagecollect() was called previously and
|
||||||
// we are now at the toplevel.
|
// we are now at the toplevel.
|
||||||
@@ -1429,6 +1424,9 @@ int vgetc(void)
|
|||||||
mouse_row = old_mouse_row;
|
mouse_row = old_mouse_row;
|
||||||
mouse_col = old_mouse_col;
|
mouse_col = old_mouse_col;
|
||||||
} else {
|
} else {
|
||||||
|
int c2;
|
||||||
|
int n;
|
||||||
|
int i;
|
||||||
// number of characters recorded from the last vgetc() call
|
// number of characters recorded from the last vgetc() call
|
||||||
static size_t last_vgetc_recorded_len = 0;
|
static size_t last_vgetc_recorded_len = 0;
|
||||||
|
|
||||||
@@ -1754,9 +1752,9 @@ static void getchar_common(typval_T *argvars, typval_T *rettv)
|
|||||||
int grid = mouse_grid;
|
int grid = mouse_grid;
|
||||||
linenr_T lnum;
|
linenr_T lnum;
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
int winnr = 1;
|
|
||||||
|
|
||||||
if (row >= 0 && col >= 0) {
|
if (row >= 0 && col >= 0) {
|
||||||
|
int winnr = 1;
|
||||||
// Find the window at the mouse coordinates and compute the
|
// Find the window at the mouse coordinates and compute the
|
||||||
// text position.
|
// text position.
|
||||||
win_T *const win = mouse_find_win(&grid, &row, &col);
|
win_T *const win = mouse_find_win(&grid, &row, &col);
|
||||||
@@ -1921,9 +1919,7 @@ static int handle_mapping(int *keylenp, const bool *timedout, int *mapdepth)
|
|||||||
int max_mlen = 0;
|
int max_mlen = 0;
|
||||||
int tb_c1;
|
int tb_c1;
|
||||||
int mlen;
|
int mlen;
|
||||||
int nolmaplen;
|
|
||||||
int keylen = *keylenp;
|
int keylen = *keylenp;
|
||||||
int i;
|
|
||||||
int local_State = get_real_state();
|
int local_State = get_real_state();
|
||||||
bool is_plug_map = false;
|
bool is_plug_map = false;
|
||||||
|
|
||||||
@@ -1956,6 +1952,7 @@ static int handle_mapping(int *keylenp, const bool *timedout, int *mapdepth)
|
|||||||
&& State != MODE_ASKMORE
|
&& State != MODE_ASKMORE
|
||||||
&& State != MODE_CONFIRM
|
&& State != MODE_CONFIRM
|
||||||
&& !at_ins_compl_key()) {
|
&& !at_ins_compl_key()) {
|
||||||
|
int nolmaplen;
|
||||||
if (tb_c1 == K_SPECIAL) {
|
if (tb_c1 == K_SPECIAL) {
|
||||||
nolmaplen = 2;
|
nolmaplen = 2;
|
||||||
} else {
|
} else {
|
||||||
@@ -2168,6 +2165,7 @@ static int handle_mapping(int *keylenp, const bool *timedout, int *mapdepth)
|
|||||||
|
|
||||||
// complete match
|
// complete match
|
||||||
if (keylen >= 0 && keylen <= typebuf.tb_len) {
|
if (keylen >= 0 && keylen <= typebuf.tb_len) {
|
||||||
|
int i;
|
||||||
char *map_str = NULL;
|
char *map_str = NULL;
|
||||||
|
|
||||||
// Write chars to script file(s).
|
// Write chars to script file(s).
|
||||||
@@ -2509,9 +2507,6 @@ static int vgetorpeek(bool advance)
|
|||||||
&& (State & MODE_INSERT)
|
&& (State & MODE_INSERT)
|
||||||
&& (p_timeout || (keylen == KEYLEN_PART_KEY && p_ttimeout))
|
&& (p_timeout || (keylen == KEYLEN_PART_KEY && p_ttimeout))
|
||||||
&& (c = inchar(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len, 3, 25L)) == 0) {
|
&& (c = inchar(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len, 3, 25L)) == 0) {
|
||||||
colnr_T col = 0;
|
|
||||||
char_u *ptr;
|
|
||||||
|
|
||||||
if (mode_displayed) {
|
if (mode_displayed) {
|
||||||
unshowmode(true);
|
unshowmode(true);
|
||||||
mode_deleted = true;
|
mode_deleted = true;
|
||||||
@@ -2522,6 +2517,8 @@ static int vgetorpeek(bool advance)
|
|||||||
|
|
||||||
// move cursor left, if possible
|
// move cursor left, if possible
|
||||||
if (curwin->w_cursor.col != 0) {
|
if (curwin->w_cursor.col != 0) {
|
||||||
|
colnr_T col = 0;
|
||||||
|
char_u *ptr;
|
||||||
if (curwin->w_wcol > 0) {
|
if (curwin->w_wcol > 0) {
|
||||||
// After auto-indenting and no text is following,
|
// After auto-indenting and no text is following,
|
||||||
// we are expecting to truncate the trailing
|
// we are expecting to truncate the trailing
|
||||||
|
@@ -660,7 +660,6 @@ void fix_help_buffer(void)
|
|||||||
{
|
{
|
||||||
linenr_T lnum;
|
linenr_T lnum;
|
||||||
char *line;
|
char *line;
|
||||||
bool in_example = false;
|
|
||||||
|
|
||||||
// Set filetype to "help".
|
// Set filetype to "help".
|
||||||
if (strcmp(curbuf->b_p_ft, "help") != 0) {
|
if (strcmp(curbuf->b_p_ft, "help") != 0) {
|
||||||
@@ -670,6 +669,7 @@ void fix_help_buffer(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!syntax_present(curwin)) {
|
if (!syntax_present(curwin)) {
|
||||||
|
bool in_example = false;
|
||||||
for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; lnum++) {
|
for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; lnum++) {
|
||||||
line = ml_get_buf(curbuf, lnum, false);
|
line = ml_get_buf(curbuf, lnum, false);
|
||||||
const size_t len = strlen(line);
|
const size_t len = strlen(line);
|
||||||
@@ -722,9 +722,7 @@ void fix_help_buffer(void)
|
|||||||
&& path_full_compare(rt, NameBuff, false, true) != kEqualFiles) {
|
&& path_full_compare(rt, NameBuff, false, true) != kEqualFiles) {
|
||||||
int fcount;
|
int fcount;
|
||||||
char **fnames;
|
char **fnames;
|
||||||
char *s;
|
|
||||||
vimconv_T vc;
|
vimconv_T vc;
|
||||||
char *cp;
|
|
||||||
|
|
||||||
// Find all "doc/ *.txt" files in this directory.
|
// Find all "doc/ *.txt" files in this directory.
|
||||||
if (!add_pathsep(NameBuff)
|
if (!add_pathsep(NameBuff)
|
||||||
@@ -740,6 +738,8 @@ void fix_help_buffer(void)
|
|||||||
if (gen_expand_wildcards(1, buff_list, &fcount,
|
if (gen_expand_wildcards(1, buff_list, &fcount,
|
||||||
&fnames, EW_FILE|EW_SILENT) == OK
|
&fnames, EW_FILE|EW_SILENT) == OK
|
||||||
&& fcount > 0) {
|
&& fcount > 0) {
|
||||||
|
char *s;
|
||||||
|
char *cp;
|
||||||
// If foo.abx is found use it instead of foo.txt in
|
// If foo.abx is found use it instead of foo.txt in
|
||||||
// the same directory.
|
// the same directory.
|
||||||
for (int i1 = 0; i1 < fcount; i1++) {
|
for (int i1 = 0; i1 < fcount; i1++) {
|
||||||
@@ -1080,7 +1080,6 @@ static void helptags_one(char *dir, const char *ext, const char *tagfname, bool
|
|||||||
static void do_helptags(char *dirname, bool add_help_tags, bool ignore_writeerr)
|
static void do_helptags(char *dirname, bool add_help_tags, bool ignore_writeerr)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
int len;
|
|
||||||
garray_T ga;
|
garray_T ga;
|
||||||
char lang[2];
|
char lang[2];
|
||||||
char ext[5];
|
char ext[5];
|
||||||
@@ -1111,7 +1110,7 @@ static void do_helptags(char *dirname, bool add_help_tags, bool ignore_writeerr)
|
|||||||
int j;
|
int j;
|
||||||
ga_init(&ga, 1, 10);
|
ga_init(&ga, 1, 10);
|
||||||
for (int i = 0; i < filecount; i++) {
|
for (int i = 0; i < filecount; i++) {
|
||||||
len = (int)strlen(files[i]);
|
int len = (int)strlen(files[i]);
|
||||||
if (len <= 4) {
|
if (len <= 4) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1177,7 +1176,6 @@ static void helptags_cb(char *fname, void *cookie)
|
|||||||
void ex_helptags(exarg_T *eap)
|
void ex_helptags(exarg_T *eap)
|
||||||
{
|
{
|
||||||
expand_T xpc;
|
expand_T xpc;
|
||||||
char *dirname;
|
|
||||||
bool add_help_tags = false;
|
bool add_help_tags = false;
|
||||||
|
|
||||||
// Check for ":helptags ++t {dir}".
|
// Check for ":helptags ++t {dir}".
|
||||||
@@ -1191,7 +1189,8 @@ void ex_helptags(exarg_T *eap)
|
|||||||
} else {
|
} else {
|
||||||
ExpandInit(&xpc);
|
ExpandInit(&xpc);
|
||||||
xpc.xp_context = EXPAND_DIRECTORIES;
|
xpc.xp_context = EXPAND_DIRECTORIES;
|
||||||
dirname = ExpandOne(&xpc, eap->arg, NULL, WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE);
|
char *dirname =
|
||||||
|
ExpandOne(&xpc, eap->arg, NULL, WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE);
|
||||||
if (dirname == NULL || !os_isdir(dirname)) {
|
if (dirname == NULL || !os_isdir(dirname)) {
|
||||||
semsg(_("E150: Not a directory: %s"), eap->arg);
|
semsg(_("E150: Not a directory: %s"), eap->arg);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -460,7 +460,6 @@ int set_indent(int size, int flags)
|
|||||||
int line_len;
|
int line_len;
|
||||||
int doit = false;
|
int doit = false;
|
||||||
int ind_done = 0; // Measured in spaces.
|
int ind_done = 0; // Measured in spaces.
|
||||||
int ind_col = 0;
|
|
||||||
int tab_pad;
|
int tab_pad;
|
||||||
int retval = false;
|
int retval = false;
|
||||||
|
|
||||||
@@ -479,6 +478,7 @@ int set_indent(int size, int flags)
|
|||||||
// 'preserveindent' are set count the number of characters at the
|
// 'preserveindent' are set count the number of characters at the
|
||||||
// beginning of the line to be copied.
|
// beginning of the line to be copied.
|
||||||
if (!curbuf->b_p_et || (!(flags & SIN_INSERT) && curbuf->b_p_pi)) {
|
if (!curbuf->b_p_et || (!(flags & SIN_INSERT) && curbuf->b_p_pi)) {
|
||||||
|
int ind_col = 0;
|
||||||
// If 'preserveindent' is set then reuse as much as possible of
|
// If 'preserveindent' is set then reuse as much as possible of
|
||||||
// the existing indent structure for the new indent.
|
// the existing indent structure for the new indent.
|
||||||
if (!(flags & SIN_INSERT) && curbuf->b_p_pi) {
|
if (!(flags & SIN_INSERT) && curbuf->b_p_pi) {
|
||||||
@@ -936,14 +936,10 @@ void ex_retab(exarg_T *eap)
|
|||||||
long num_spaces = 0;
|
long num_spaces = 0;
|
||||||
long num_tabs;
|
long num_tabs;
|
||||||
long len;
|
long len;
|
||||||
long col;
|
|
||||||
long vcol;
|
|
||||||
long start_col = 0; // For start of white-space string
|
long start_col = 0; // For start of white-space string
|
||||||
long start_vcol = 0; // For start of white-space string
|
long start_vcol = 0; // For start of white-space string
|
||||||
long old_len;
|
long old_len;
|
||||||
char *ptr;
|
|
||||||
char *new_line = (char *)1; // init to non-NULL
|
char *new_line = (char *)1; // init to non-NULL
|
||||||
bool did_undo; // called u_save for current line
|
|
||||||
long *new_vts_array = NULL;
|
long *new_vts_array = NULL;
|
||||||
char *new_ts_str; // string value of tab argument
|
char *new_ts_str; // string value of tab argument
|
||||||
|
|
||||||
@@ -972,10 +968,10 @@ void ex_retab(exarg_T *eap)
|
|||||||
new_ts_str = xstrnsave(new_ts_str, (size_t)(eap->arg - new_ts_str));
|
new_ts_str = xstrnsave(new_ts_str, (size_t)(eap->arg - new_ts_str));
|
||||||
}
|
}
|
||||||
for (lnum = eap->line1; !got_int && lnum <= eap->line2; lnum++) {
|
for (lnum = eap->line1; !got_int && lnum <= eap->line2; lnum++) {
|
||||||
ptr = ml_get(lnum);
|
char *ptr = ml_get(lnum);
|
||||||
col = 0;
|
long col = 0;
|
||||||
vcol = 0;
|
long vcol = 0;
|
||||||
did_undo = false;
|
bool did_undo = false; // called u_save for current line
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (ascii_iswhite(ptr[col])) {
|
if (ascii_iswhite(ptr[col])) {
|
||||||
if (!got_tab && num_spaces == 0) {
|
if (!got_tab && num_spaces == 0) {
|
||||||
@@ -1186,10 +1182,6 @@ int get_lisp_indent(void)
|
|||||||
pos_T *pos, realpos, paren;
|
pos_T *pos, realpos, paren;
|
||||||
int amount;
|
int amount;
|
||||||
char *that;
|
char *that;
|
||||||
colnr_T col;
|
|
||||||
colnr_T firsttry;
|
|
||||||
int parencount;
|
|
||||||
int quotecount;
|
|
||||||
int vi_lisp;
|
int vi_lisp;
|
||||||
|
|
||||||
// Set vi_lisp to use the vi-compatible method.
|
// Set vi_lisp to use the vi-compatible method.
|
||||||
@@ -1213,7 +1205,7 @@ int get_lisp_indent(void)
|
|||||||
// Extra trick: Take the indent of the first previous non-white
|
// Extra trick: Take the indent of the first previous non-white
|
||||||
// line that is at the same () level.
|
// line that is at the same () level.
|
||||||
amount = -1;
|
amount = -1;
|
||||||
parencount = 0;
|
int parencount = 0;
|
||||||
|
|
||||||
while (--curwin->w_cursor.lnum >= pos->lnum) {
|
while (--curwin->w_cursor.lnum >= pos->lnum) {
|
||||||
if (linewhite(curwin->w_cursor.lnum)) {
|
if (linewhite(curwin->w_cursor.lnum)) {
|
||||||
@@ -1268,7 +1260,7 @@ int get_lisp_indent(void)
|
|||||||
if (amount == -1) {
|
if (amount == -1) {
|
||||||
curwin->w_cursor.lnum = pos->lnum;
|
curwin->w_cursor.lnum = pos->lnum;
|
||||||
curwin->w_cursor.col = pos->col;
|
curwin->w_cursor.col = pos->col;
|
||||||
col = pos->col;
|
colnr_T col = pos->col;
|
||||||
|
|
||||||
that = get_cursor_line_ptr();
|
that = get_cursor_line_ptr();
|
||||||
|
|
||||||
@@ -1298,7 +1290,7 @@ int get_lisp_indent(void)
|
|||||||
that++;
|
that++;
|
||||||
amount++;
|
amount++;
|
||||||
}
|
}
|
||||||
firsttry = amount;
|
colnr_T firsttry = amount;
|
||||||
|
|
||||||
init_chartabsize_arg(&cts, curwin, (colnr_T)(that - line),
|
init_chartabsize_arg(&cts, curwin, (colnr_T)(that - line),
|
||||||
amount, line, that);
|
amount, line, that);
|
||||||
@@ -1319,13 +1311,13 @@ int get_lisp_indent(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
parencount = 0;
|
parencount = 0;
|
||||||
quotecount = 0;
|
|
||||||
|
|
||||||
init_chartabsize_arg(&cts, curwin,
|
init_chartabsize_arg(&cts, curwin,
|
||||||
(colnr_T)(that - line), amount, line, that);
|
(colnr_T)(that - line), amount, line, that);
|
||||||
if (vi_lisp || ((*that != '"') && (*that != '\'')
|
if (vi_lisp || ((*that != '"') && (*that != '\'')
|
||||||
&& (*that != '#')
|
&& (*that != '#')
|
||||||
&& (((uint8_t)(*that) < '0') || ((uint8_t)(*that) > '9')))) {
|
&& (((uint8_t)(*that) < '0') || ((uint8_t)(*that) > '9')))) {
|
||||||
|
int quotecount = 0;
|
||||||
while (*cts.cts_ptr
|
while (*cts.cts_ptr
|
||||||
&& (!ascii_iswhite(*cts.cts_ptr) || quotecount || parencount)
|
&& (!ascii_iswhite(*cts.cts_ptr) || quotecount || parencount)
|
||||||
&& (!((*cts.cts_ptr == '(' || *cts.cts_ptr == '[')
|
&& (!((*cts.cts_ptr == '(' || *cts.cts_ptr == '[')
|
||||||
@@ -1373,12 +1365,11 @@ int get_lisp_indent(void)
|
|||||||
static int lisp_match(char *p)
|
static int lisp_match(char *p)
|
||||||
{
|
{
|
||||||
char buf[LSIZE];
|
char buf[LSIZE];
|
||||||
int len;
|
|
||||||
char *word = *curbuf->b_p_lw != NUL ? curbuf->b_p_lw : p_lispwords;
|
char *word = *curbuf->b_p_lw != NUL ? curbuf->b_p_lw : p_lispwords;
|
||||||
|
|
||||||
while (*word != NUL) {
|
while (*word != NUL) {
|
||||||
(void)copy_option_part(&word, buf, LSIZE, ",");
|
(void)copy_option_part(&word, buf, LSIZE, ",");
|
||||||
len = (int)strlen(buf);
|
int len = (int)strlen(buf);
|
||||||
|
|
||||||
if ((strncmp(buf, p, (size_t)len) == 0) && ascii_iswhite_or_nul(p[len])) {
|
if ((strncmp(buf, p, (size_t)len) == 0) && ascii_iswhite_or_nul(p[len])) {
|
||||||
return true;
|
return true;
|
||||||
|
@@ -1434,15 +1434,11 @@ int ExpandMappings(char *pat, regmatch_T *regmatch, int *numMatches, char ***mat
|
|||||||
// Return true if there is an abbreviation, false if not.
|
// Return true if there is an abbreviation, false if not.
|
||||||
bool check_abbr(int c, char *ptr, int col, int mincol)
|
bool check_abbr(int c, char *ptr, int col, int mincol)
|
||||||
{
|
{
|
||||||
int len;
|
|
||||||
int scol; // starting column of the abbr.
|
int scol; // starting column of the abbr.
|
||||||
int j;
|
|
||||||
char *s;
|
|
||||||
char_u tb[MB_MAXBYTES + 4];
|
char_u tb[MB_MAXBYTES + 4];
|
||||||
mapblock_T *mp;
|
mapblock_T *mp;
|
||||||
mapblock_T *mp2;
|
mapblock_T *mp2;
|
||||||
int clen = 0; // length in characters
|
int clen = 0; // length in characters
|
||||||
bool is_id = true;
|
|
||||||
|
|
||||||
if (typebuf.tb_no_abbr_cnt) { // abbrev. are not recursive
|
if (typebuf.tb_no_abbr_cnt) { // abbrev. are not recursive
|
||||||
return false;
|
return false;
|
||||||
@@ -1462,6 +1458,7 @@ bool check_abbr(int c, char *ptr, int col, int mincol)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
bool is_id = true;
|
||||||
bool vim_abbr;
|
bool vim_abbr;
|
||||||
char *p = mb_prevptr(ptr, ptr + col);
|
char *p = mb_prevptr(ptr, ptr + col);
|
||||||
if (!vim_iswordp(p)) {
|
if (!vim_iswordp(p)) {
|
||||||
@@ -1489,7 +1486,7 @@ bool check_abbr(int c, char *ptr, int col, int mincol)
|
|||||||
}
|
}
|
||||||
if (scol < col) { // there is a word in front of the cursor
|
if (scol < col) { // there is a word in front of the cursor
|
||||||
ptr += scol;
|
ptr += scol;
|
||||||
len = col - scol;
|
int len = col - scol;
|
||||||
mp = curbuf->b_first_abbr;
|
mp = curbuf->b_first_abbr;
|
||||||
mp2 = first_abbr;
|
mp2 = first_abbr;
|
||||||
if (mp == NULL) {
|
if (mp == NULL) {
|
||||||
@@ -1532,7 +1529,7 @@ bool check_abbr(int c, char *ptr, int col, int mincol)
|
|||||||
//
|
//
|
||||||
// Character CTRL-] is treated specially - it completes the
|
// Character CTRL-] is treated specially - it completes the
|
||||||
// abbreviation, but is not inserted into the input stream.
|
// abbreviation, but is not inserted into the input stream.
|
||||||
j = 0;
|
int j = 0;
|
||||||
if (c != Ctrl_RSB) {
|
if (c != Ctrl_RSB) {
|
||||||
// special key code, split up
|
// special key code, split up
|
||||||
if (IS_SPECIAL(c) || c == K_SPECIAL) {
|
if (IS_SPECIAL(c) || c == K_SPECIAL) {
|
||||||
@@ -1568,6 +1565,7 @@ bool check_abbr(int c, char *ptr, int col, int mincol)
|
|||||||
const bool silent = mp->m_silent;
|
const bool silent = mp->m_silent;
|
||||||
const bool expr = mp->m_expr;
|
const bool expr = mp->m_expr;
|
||||||
|
|
||||||
|
char *s;
|
||||||
if (expr) {
|
if (expr) {
|
||||||
s = eval_map_expr(mp, c);
|
s = eval_map_expr(mp, c);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -449,18 +449,16 @@ int mb_get_class_tab(const char *p, const uint64_t *const chartab)
|
|||||||
static bool intable(const struct interval *table, size_t n_items, int c)
|
static bool intable(const struct interval *table, size_t n_items, int c)
|
||||||
FUNC_ATTR_PURE
|
FUNC_ATTR_PURE
|
||||||
{
|
{
|
||||||
int mid, bot, top;
|
|
||||||
|
|
||||||
// first quick check for Latin1 etc. characters
|
// first quick check for Latin1 etc. characters
|
||||||
if (c < table[0].first) {
|
if (c < table[0].first) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// binary search in table
|
// binary search in table
|
||||||
bot = 0;
|
int bot = 0;
|
||||||
top = (int)(n_items - 1);
|
int top = (int)(n_items - 1);
|
||||||
while (top >= bot) {
|
while (top >= bot) {
|
||||||
mid = (bot + top) / 2;
|
int mid = (bot + top) / 2;
|
||||||
if (table[mid].last < c) {
|
if (table[mid].last < c) {
|
||||||
bot = mid + 1;
|
bot = mid + 1;
|
||||||
} else if (table[mid].first > c) {
|
} else if (table[mid].first > c) {
|
||||||
@@ -518,11 +516,9 @@ int utf_char2cells(int c)
|
|||||||
/// This doesn't take care of unprintable characters, use ptr2cells() for that.
|
/// This doesn't take care of unprintable characters, use ptr2cells() for that.
|
||||||
int utf_ptr2cells(const char *p)
|
int utf_ptr2cells(const char *p)
|
||||||
{
|
{
|
||||||
int c;
|
|
||||||
|
|
||||||
// Need to convert to a character number.
|
// Need to convert to a character number.
|
||||||
if ((uint8_t)(*p) >= 0x80) {
|
if ((uint8_t)(*p) >= 0x80) {
|
||||||
c = utf_ptr2char(p);
|
int c = utf_ptr2char(p);
|
||||||
// An illegal byte is displayed as <xx>.
|
// An illegal byte is displayed as <xx>.
|
||||||
if (utf_ptr2len(p) == 1 || c == NUL) {
|
if (utf_ptr2len(p) == 1 || c == NUL) {
|
||||||
return 4;
|
return 4;
|
||||||
@@ -540,14 +536,12 @@ int utf_ptr2cells(const char *p)
|
|||||||
/// For an empty string or truncated character returns 1.
|
/// For an empty string or truncated character returns 1.
|
||||||
int utf_ptr2cells_len(const char *p, int size)
|
int utf_ptr2cells_len(const char *p, int size)
|
||||||
{
|
{
|
||||||
int c;
|
|
||||||
|
|
||||||
// Need to convert to a wide character.
|
// Need to convert to a wide character.
|
||||||
if (size > 0 && (uint8_t)(*p) >= 0x80) {
|
if (size > 0 && (uint8_t)(*p) >= 0x80) {
|
||||||
if (utf_ptr2len_len(p, size) < utf8len_tab[(uint8_t)(*p)]) {
|
if (utf_ptr2len_len(p, size) < utf8len_tab[(uint8_t)(*p)]) {
|
||||||
return 1; // truncated
|
return 1; // truncated
|
||||||
}
|
}
|
||||||
c = utf_ptr2char((char *)p);
|
int c = utf_ptr2char((char *)p);
|
||||||
// An illegal byte is displayed as <xx>.
|
// An illegal byte is displayed as <xx>.
|
||||||
if (utf_ptr2len((char *)p) == 1 || c == NUL) {
|
if (utf_ptr2len((char *)p) == 1 || c == NUL) {
|
||||||
return 4;
|
return 4;
|
||||||
@@ -664,8 +658,6 @@ int utf_ptr2char(const char *const p_in)
|
|||||||
// "s".
|
// "s".
|
||||||
static int utf_safe_read_char_adv(const char_u **s, size_t *n)
|
static int utf_safe_read_char_adv(const char_u **s, size_t *n)
|
||||||
{
|
{
|
||||||
int c;
|
|
||||||
|
|
||||||
if (*n == 0) { // end of buffer
|
if (*n == 0) { // end of buffer
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -682,7 +674,7 @@ static int utf_safe_read_char_adv(const char_u **s, size_t *n)
|
|||||||
// We have a multibyte sequence and it isn't truncated by buffer
|
// We have a multibyte sequence and it isn't truncated by buffer
|
||||||
// limits so utf_ptr2char() is safe to use. Or the first byte is
|
// limits so utf_ptr2char() is safe to use. Or the first byte is
|
||||||
// illegal (k=0), and it's also safe to use utf_ptr2char().
|
// illegal (k=0), and it's also safe to use utf_ptr2char().
|
||||||
c = utf_ptr2char((char *)(*s));
|
int c = utf_ptr2char((char *)(*s));
|
||||||
|
|
||||||
// On failure, utf_ptr2char() returns the first byte, so here we
|
// On failure, utf_ptr2char() returns the first byte, so here we
|
||||||
// check equality with the first byte. The only non-ASCII character
|
// check equality with the first byte. The only non-ASCII character
|
||||||
@@ -1141,7 +1133,6 @@ int utf_class_tab(const int c, const uint64_t *const chartab)
|
|||||||
};
|
};
|
||||||
int bot = 0;
|
int bot = 0;
|
||||||
int top = ARRAY_SIZE(classes) - 1;
|
int top = ARRAY_SIZE(classes) - 1;
|
||||||
int mid;
|
|
||||||
|
|
||||||
// First quick check for Latin1 characters, use 'iskeyword'.
|
// First quick check for Latin1 characters, use 'iskeyword'.
|
||||||
if (c < 0x100) {
|
if (c < 0x100) {
|
||||||
@@ -1161,7 +1152,7 @@ int utf_class_tab(const int c, const uint64_t *const chartab)
|
|||||||
|
|
||||||
// binary search in table
|
// binary search in table
|
||||||
while (top >= bot) {
|
while (top >= bot) {
|
||||||
mid = (bot + top) / 2;
|
int mid = (bot + top) / 2;
|
||||||
if (classes[mid].last < (unsigned int)c) {
|
if (classes[mid].last < (unsigned int)c) {
|
||||||
bot = mid + 1;
|
bot = mid + 1;
|
||||||
} else if (classes[mid].first > (unsigned int)c) {
|
} else if (classes[mid].first > (unsigned int)c) {
|
||||||
@@ -1186,13 +1177,12 @@ bool utf_ambiguous_width(int c)
|
|||||||
// the given conversion "table". Uses binary search on "table".
|
// the given conversion "table". Uses binary search on "table".
|
||||||
static int utf_convert(int a, const convertStruct *const table, size_t n_items)
|
static int utf_convert(int a, const convertStruct *const table, size_t n_items)
|
||||||
{
|
{
|
||||||
size_t start, mid, end; // indices into table
|
// indices into table
|
||||||
|
size_t start = 0;
|
||||||
start = 0;
|
size_t end = n_items;
|
||||||
end = n_items;
|
|
||||||
while (start < end) {
|
while (start < end) {
|
||||||
// need to search further
|
// need to search further
|
||||||
mid = (end + start) / 2;
|
size_t mid = (end + start) / 2;
|
||||||
if (table[mid].rangeEnd < a) {
|
if (table[mid].rangeEnd < a) {
|
||||||
start = mid + 1;
|
start = mid + 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -1579,9 +1569,6 @@ void show_utf8(void)
|
|||||||
/// Returns 0 when already at the first byte of a character.
|
/// Returns 0 when already at the first byte of a character.
|
||||||
int utf_head_off(const char *base_in, const char *p_in)
|
int utf_head_off(const char *base_in, const char *p_in)
|
||||||
{
|
{
|
||||||
int c;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
if ((uint8_t)(*p_in) < 0x80) { // be quick for ASCII
|
if ((uint8_t)(*p_in) < 0x80) { // be quick for ASCII
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1603,7 +1590,7 @@ int utf_head_off(const char *base_in, const char *p_in)
|
|||||||
}
|
}
|
||||||
// Check for illegal sequence. Do allow an illegal byte after where we
|
// Check for illegal sequence. Do allow an illegal byte after where we
|
||||||
// started.
|
// started.
|
||||||
len = utf8len_tab[*q];
|
int len = utf8len_tab[*q];
|
||||||
if (len != (int)(s - q + 1) && len != (int)(p - q + 1)) {
|
if (len != (int)(s - q + 1) && len != (int)(p - q + 1)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1612,7 +1599,7 @@ int utf_head_off(const char *base_in, const char *p_in)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
c = utf_ptr2char((char *)q);
|
int c = utf_ptr2char((char *)q);
|
||||||
if (utf_iscomposing(c)) {
|
if (utf_iscomposing(c)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1795,7 +1782,6 @@ int mb_off_next(const char *base, const char *p_in)
|
|||||||
{
|
{
|
||||||
const uint8_t *p = (uint8_t *)p_in;
|
const uint8_t *p = (uint8_t *)p_in;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
|
||||||
|
|
||||||
if (*p < 0x80) { // be quick for ASCII
|
if (*p < 0x80) { // be quick for ASCII
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1804,6 +1790,7 @@ int mb_off_next(const char *base, const char *p_in)
|
|||||||
// Find the next character that isn't 10xx.xxxx
|
// Find the next character that isn't 10xx.xxxx
|
||||||
for (i = 0; (p[i] & 0xc0) == 0x80; i++) {}
|
for (i = 0; (p[i] & 0xc0) == 0x80; i++) {}
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
|
int j;
|
||||||
// Check for illegal sequence.
|
// Check for illegal sequence.
|
||||||
for (j = 0; p - j > (uint8_t *)base; j++) {
|
for (j = 0; p - j > (uint8_t *)base; j++) {
|
||||||
if ((p[-j] & 0xc0) != 0x80) {
|
if ((p[-j] & 0xc0) != 0x80) {
|
||||||
@@ -2479,7 +2466,6 @@ char *string_convert_ext(const vimconv_T *const vcp, char *ptr, size_t *lenp, si
|
|||||||
{
|
{
|
||||||
char_u *retval = NULL;
|
char_u *retval = NULL;
|
||||||
char_u *d;
|
char_u *d;
|
||||||
int l;
|
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
size_t len;
|
size_t len;
|
||||||
@@ -2547,7 +2533,7 @@ char *string_convert_ext(const vimconv_T *const vcp, char *ptr, size_t *lenp, si
|
|||||||
retval = xmalloc(len + 1);
|
retval = xmalloc(len + 1);
|
||||||
d = retval;
|
d = retval;
|
||||||
for (size_t i = 0; i < len; i++) {
|
for (size_t i = 0; i < len; i++) {
|
||||||
l = utf_ptr2len_len(ptr + i, (int)(len - i));
|
int l = utf_ptr2len_len(ptr + i, (int)(len - i));
|
||||||
if (l == 0) {
|
if (l == 0) {
|
||||||
*d++ = NUL;
|
*d++ = NUL;
|
||||||
} else if (l == 1) {
|
} else if (l == 1) {
|
||||||
|
@@ -86,15 +86,11 @@ static int get_mouse_class(char *p)
|
|||||||
/// Move "pos" back to the start of the word it's in.
|
/// Move "pos" back to the start of the word it's in.
|
||||||
static void find_start_of_word(pos_T *pos)
|
static void find_start_of_word(pos_T *pos)
|
||||||
{
|
{
|
||||||
char *line;
|
char *line = ml_get(pos->lnum);
|
||||||
int cclass;
|
int cclass = get_mouse_class(line + pos->col);
|
||||||
int col;
|
|
||||||
|
|
||||||
line = ml_get(pos->lnum);
|
|
||||||
cclass = get_mouse_class(line + pos->col);
|
|
||||||
|
|
||||||
while (pos->col > 0) {
|
while (pos->col > 0) {
|
||||||
col = pos->col - 1;
|
int col = pos->col - 1;
|
||||||
col -= utf_head_off(line, line + col);
|
col -= utf_head_off(line, line + col);
|
||||||
if (get_mouse_class(line + col) != cclass) {
|
if (get_mouse_class(line + col) != cclass) {
|
||||||
break;
|
break;
|
||||||
@@ -109,7 +105,6 @@ static void find_end_of_word(pos_T *pos)
|
|||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
int cclass;
|
int cclass;
|
||||||
int col;
|
|
||||||
|
|
||||||
line = ml_get(pos->lnum);
|
line = ml_get(pos->lnum);
|
||||||
if (*p_sel == 'e' && pos->col > 0) {
|
if (*p_sel == 'e' && pos->col > 0) {
|
||||||
@@ -118,7 +113,7 @@ static void find_end_of_word(pos_T *pos)
|
|||||||
}
|
}
|
||||||
cclass = get_mouse_class(line + pos->col);
|
cclass = get_mouse_class(line + pos->col);
|
||||||
while (line[pos->col] != NUL) {
|
while (line[pos->col] != NUL) {
|
||||||
col = pos->col + utfc_ptr2len(line + pos->col);
|
int col = pos->col + utfc_ptr2len(line + pos->col);
|
||||||
if (get_mouse_class(line + col) != cclass) {
|
if (get_mouse_class(line + col) != cclass) {
|
||||||
if (*p_sel == 'e') {
|
if (*p_sel == 'e') {
|
||||||
pos->col = col;
|
pos->col = col;
|
||||||
@@ -296,18 +291,16 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
|
|||||||
bool in_status_line; // mouse in status line
|
bool in_status_line; // mouse in status line
|
||||||
static bool in_tab_line = false; // mouse clicked in tab line
|
static bool in_tab_line = false; // mouse clicked in tab line
|
||||||
bool in_sep_line; // mouse in vertical separator line
|
bool in_sep_line; // mouse in vertical separator line
|
||||||
int c1, c2;
|
int c1;
|
||||||
pos_T save_cursor;
|
|
||||||
win_T *old_curwin = curwin;
|
win_T *old_curwin = curwin;
|
||||||
static pos_T orig_cursor;
|
static pos_T orig_cursor;
|
||||||
colnr_T leftcol, rightcol;
|
colnr_T leftcol, rightcol;
|
||||||
pos_T end_visual;
|
pos_T end_visual;
|
||||||
long diff;
|
|
||||||
int old_active = VIsual_active;
|
int old_active = VIsual_active;
|
||||||
int old_mode = VIsual_mode;
|
int old_mode = VIsual_mode;
|
||||||
int regname;
|
int regname;
|
||||||
|
|
||||||
save_cursor = curwin->w_cursor;
|
pos_T save_cursor = curwin->w_cursor;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
which_button = get_mouse_button(KEY2TERMCAP1(c), &is_click, &is_drag);
|
which_button = get_mouse_button(KEY2TERMCAP1(c), &is_click, &is_drag);
|
||||||
@@ -731,6 +724,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start_visual.lnum) { // right click in visual mode
|
if (start_visual.lnum) { // right click in visual mode
|
||||||
|
long 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;
|
||||||
@@ -800,6 +794,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
|
|||||||
|
|
||||||
// Middle mouse click: Put text before cursor.
|
// Middle mouse click: Put text before cursor.
|
||||||
if (which_button == MOUSE_MIDDLE) {
|
if (which_button == MOUSE_MIDDLE) {
|
||||||
|
int c2;
|
||||||
if (regname == 0 && eval_has_provider("clipboard")) {
|
if (regname == 0 && eval_has_provider("clipboard")) {
|
||||||
regname = '*';
|
regname = '*';
|
||||||
}
|
}
|
||||||
@@ -888,13 +883,13 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
|
|||||||
// A double click selects a word or a block.
|
// A double click selects a word or a block.
|
||||||
if ((mod_mask & MOD_MASK_MULTI_CLICK) == MOD_MASK_2CLICK) {
|
if ((mod_mask & MOD_MASK_MULTI_CLICK) == MOD_MASK_2CLICK) {
|
||||||
pos_T *pos = NULL;
|
pos_T *pos = NULL;
|
||||||
int gc;
|
|
||||||
|
|
||||||
if (is_click) {
|
if (is_click) {
|
||||||
// If the character under the cursor (skipping white space) is
|
// If the character under the cursor (skipping white space) is
|
||||||
// not a word character, try finding a match and select a (),
|
// not a word character, try finding a match and select a (),
|
||||||
// {}, [], #if/#endif, etc. block.
|
// {}, [], #if/#endif, etc. block.
|
||||||
end_visual = curwin->w_cursor;
|
end_visual = curwin->w_cursor;
|
||||||
|
int gc;
|
||||||
while (gc = gchar_pos(&end_visual), ascii_iswhite(gc)) {
|
while (gc = gchar_pos(&end_visual), ascii_iswhite(gc)) {
|
||||||
inc(&end_visual);
|
inc(&end_visual);
|
||||||
}
|
}
|
||||||
@@ -1388,16 +1383,14 @@ bool mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump)
|
|||||||
{
|
{
|
||||||
int col = *colp;
|
int col = *colp;
|
||||||
int row = *rowp;
|
int row = *rowp;
|
||||||
linenr_T lnum;
|
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
int off;
|
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
if (win->w_p_rl) {
|
if (win->w_p_rl) {
|
||||||
col = win->w_width_inner - 1 - col;
|
col = win->w_width_inner - 1 - col;
|
||||||
}
|
}
|
||||||
|
|
||||||
lnum = win->w_topline;
|
linenr_T lnum = win->w_topline;
|
||||||
|
|
||||||
while (row > 0) {
|
while (row > 0) {
|
||||||
// Don't include filler lines in "count"
|
// Don't include filler lines in "count"
|
||||||
@@ -1429,7 +1422,7 @@ bool mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump)
|
|||||||
|
|
||||||
if (!retval) {
|
if (!retval) {
|
||||||
// Compute the column without wrapping.
|
// Compute the column without wrapping.
|
||||||
off = win_col_off(win) - win_col_off2(win);
|
int off = win_col_off(win) - win_col_off2(win);
|
||||||
if (col < off) {
|
if (col < off) {
|
||||||
col = off;
|
col = off;
|
||||||
}
|
}
|
||||||
@@ -1467,9 +1460,7 @@ win_T *mouse_find_win(int *gridp, int *rowp, int *colp)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_T *fp;
|
frame_T *fp = topframe;
|
||||||
|
|
||||||
fp = topframe;
|
|
||||||
*rowp -= firstwin->w_winrow;
|
*rowp -= firstwin->w_winrow;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (fp->fr_layout == FR_LEAF) {
|
if (fp->fr_layout == FR_LEAF) {
|
||||||
@@ -1716,10 +1707,8 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
|
|||||||
ptr_end += utfc_ptr2len(ptr_end);
|
ptr_end += utfc_ptr2len(ptr_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
int matchid;
|
|
||||||
int prev_matchid;
|
int prev_matchid;
|
||||||
int nudge = 0;
|
int nudge = 0;
|
||||||
int cwidth = 0;
|
|
||||||
|
|
||||||
vcol = offset;
|
vcol = offset;
|
||||||
|
|
||||||
@@ -1727,7 +1716,7 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
|
|||||||
#define DECR() nudge--; ptr_end -= utfc_ptr2len((char *)ptr_end)
|
#define DECR() nudge--; ptr_end -= utfc_ptr2len((char *)ptr_end)
|
||||||
|
|
||||||
while (ptr < ptr_end && *ptr != NUL) {
|
while (ptr < ptr_end && *ptr != NUL) {
|
||||||
cwidth = win_chartabsize(curwin, ptr, vcol);
|
int cwidth = win_chartabsize(curwin, ptr, vcol);
|
||||||
vcol += cwidth;
|
vcol += cwidth;
|
||||||
if (cwidth > 1 && *ptr == '\t' && nudge > 0) {
|
if (cwidth > 1 && *ptr == '\t' && nudge > 0) {
|
||||||
// A tab will "absorb" any previous adjustments.
|
// A tab will "absorb" any previous adjustments.
|
||||||
@@ -1738,7 +1727,7 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
matchid = syn_get_concealed_id(wp, lnum, (colnr_T)(ptr - line));
|
int matchid = syn_get_concealed_id(wp, lnum, (colnr_T)(ptr - line));
|
||||||
if (matchid != 0) {
|
if (matchid != 0) {
|
||||||
if (wp->w_p_cole == 3) {
|
if (wp->w_p_cole == 3) {
|
||||||
INCR();
|
INCR();
|
||||||
@@ -1780,9 +1769,7 @@ int mouse_check_fold(void)
|
|||||||
int max_col = Columns;
|
int max_col = Columns;
|
||||||
int multigrid = ui_has(kUIMultigrid);
|
int multigrid = ui_has(kUIMultigrid);
|
||||||
|
|
||||||
win_T *wp;
|
win_T *wp = mouse_find_win(&click_grid, &click_row, &click_col);
|
||||||
|
|
||||||
wp = mouse_find_win(&click_grid, &click_row, &click_col);
|
|
||||||
if (wp && multigrid) {
|
if (wp && multigrid) {
|
||||||
max_row = wp->w_grid_alloc.rows;
|
max_row = wp->w_grid_alloc.rows;
|
||||||
max_col = wp->w_grid_alloc.cols;
|
max_col = wp->w_grid_alloc.cols;
|
||||||
|
104
src/nvim/ops.c
104
src/nvim/ops.c
@@ -214,7 +214,6 @@ int get_extra_op_char(int optype)
|
|||||||
void op_shift(oparg_T *oap, int curs_top, int amount)
|
void op_shift(oparg_T *oap, int curs_top, int amount)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
int first_char;
|
|
||||||
int block_col = 0;
|
int block_col = 0;
|
||||||
|
|
||||||
if (u_save((linenr_T)(oap->start.lnum - 1),
|
if (u_save((linenr_T)(oap->start.lnum - 1),
|
||||||
@@ -227,7 +226,7 @@ void op_shift(oparg_T *oap, int curs_top, int amount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = oap->line_count - 1; i >= 0; i--) {
|
for (i = oap->line_count - 1; i >= 0; i--) {
|
||||||
first_char = (uint8_t)(*get_cursor_line_ptr());
|
int first_char = (uint8_t)(*get_cursor_line_ptr());
|
||||||
if (first_char == NUL) { // empty line
|
if (first_char == NUL) { // empty line
|
||||||
curwin->w_cursor.col = 0;
|
curwin->w_cursor.col = 0;
|
||||||
} else if (oap->motion_type == kMTBlockWise) {
|
} else if (oap->motion_type == kMTBlockWise) {
|
||||||
@@ -289,15 +288,13 @@ void op_shift(oparg_T *oap, int curs_top, int amount)
|
|||||||
/// @param call_changed_bytes call changed_bytes()
|
/// @param call_changed_bytes call changed_bytes()
|
||||||
void shift_line(int left, int round, int amount, int call_changed_bytes)
|
void shift_line(int left, int round, int amount, int call_changed_bytes)
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
int i, j;
|
|
||||||
const int sw_val = (int)get_sw_value_indent(curbuf);
|
const int sw_val = (int)get_sw_value_indent(curbuf);
|
||||||
|
|
||||||
count = get_indent(); // get current indent
|
int count = get_indent(); // get current indent
|
||||||
|
|
||||||
if (round) { // round off indent
|
if (round) { // round off indent
|
||||||
i = count / sw_val; // number of 'shiftwidth' rounded down
|
int i = count / sw_val; // number of 'shiftwidth' rounded down
|
||||||
j = count % sw_val; // extra spaces
|
int j = count % sw_val; // extra spaces
|
||||||
if (j && left) { // first remove extra spaces
|
if (j && left) { // first remove extra spaces
|
||||||
amount--;
|
amount--;
|
||||||
}
|
}
|
||||||
@@ -636,8 +633,6 @@ static void block_insert(oparg_T *oap, char *s, int b_insert, struct block_def *
|
|||||||
void op_reindent(oparg_T *oap, Indenter how)
|
void op_reindent(oparg_T *oap, Indenter how)
|
||||||
{
|
{
|
||||||
long i = 0;
|
long i = 0;
|
||||||
char *l;
|
|
||||||
int amount;
|
|
||||||
linenr_T first_changed = 0;
|
linenr_T first_changed = 0;
|
||||||
linenr_T last_changed = 0;
|
linenr_T last_changed = 0;
|
||||||
linenr_T start_lnum = curwin->w_cursor.lnum;
|
linenr_T start_lnum = curwin->w_cursor.lnum;
|
||||||
@@ -652,6 +647,8 @@ void op_reindent(oparg_T *oap, Indenter how)
|
|||||||
// for each line separately, especially when undoing.
|
// for each line separately, especially when undoing.
|
||||||
if (u_savecommon(curbuf, start_lnum - 1, start_lnum + (linenr_T)oap->line_count,
|
if (u_savecommon(curbuf, start_lnum - 1, start_lnum + (linenr_T)oap->line_count,
|
||||||
start_lnum + (linenr_T)oap->line_count, false) == OK) {
|
start_lnum + (linenr_T)oap->line_count, false) == OK) {
|
||||||
|
char *l;
|
||||||
|
int amount;
|
||||||
for (i = oap->line_count - 1; i >= 0 && !got_int; i--) {
|
for (i = oap->line_count - 1; i >= 0 && !got_int; i--) {
|
||||||
// it's a slow thing to do, so give feedback so there's no worry
|
// it's a slow thing to do, so give feedback so there's no worry
|
||||||
// that the computer's just hung.
|
// that the computer's just hung.
|
||||||
@@ -902,7 +899,6 @@ bool yank_register_mline(int regname)
|
|||||||
/// @return FAIL for failure, OK otherwise.
|
/// @return FAIL for failure, OK otherwise.
|
||||||
int do_record(int c)
|
int do_record(int c)
|
||||||
{
|
{
|
||||||
char *p;
|
|
||||||
static int regname;
|
static int regname;
|
||||||
yankreg_T *old_y_previous;
|
yankreg_T *old_y_previous;
|
||||||
int retval;
|
int retval;
|
||||||
@@ -927,7 +923,7 @@ int do_record(int c)
|
|||||||
dict_T *dict = get_v_event(&save_v_event);
|
dict_T *dict = get_v_event(&save_v_event);
|
||||||
|
|
||||||
// The recorded text contents.
|
// The recorded text contents.
|
||||||
p = (char *)get_recorded();
|
char *p = (char *)get_recorded();
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
// Remove escaping for K_SPECIAL in multi-byte chars.
|
// Remove escaping for K_SPECIAL in multi-byte chars.
|
||||||
vim_unescape_ks((char_u *)p);
|
vim_unescape_ks((char_u *)p);
|
||||||
@@ -1149,7 +1145,6 @@ int do_execreg(int regname, int colon, int addcr, int silent)
|
|||||||
|
|
||||||
// Insert lines into typeahead buffer, from last one to first one.
|
// Insert lines into typeahead buffer, from last one to first one.
|
||||||
put_reedit_in_typebuf(silent);
|
put_reedit_in_typebuf(silent);
|
||||||
char *escaped;
|
|
||||||
for (size_t i = reg->y_size; i-- > 0;) { // from y_size - 1 to 0 included
|
for (size_t i = reg->y_size; i-- > 0;) { // from y_size - 1 to 0 included
|
||||||
// insert NL between lines and after last line if type is kMTLineWise
|
// insert NL between lines and after last line if type is kMTLineWise
|
||||||
if (reg->y_type == kMTLineWise || i < reg->y_size - 1 || addcr) {
|
if (reg->y_type == kMTLineWise || i < reg->y_size - 1 || addcr) {
|
||||||
@@ -1168,7 +1163,7 @@ int do_execreg(int regname, int colon, int addcr, int silent)
|
|||||||
free_str = true;
|
free_str = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
escaped = vim_strsave_escape_ks(str);
|
char *escaped = vim_strsave_escape_ks(str);
|
||||||
if (free_str) {
|
if (free_str) {
|
||||||
xfree(str);
|
xfree(str);
|
||||||
}
|
}
|
||||||
@@ -1651,10 +1646,9 @@ int op_delete(oparg_T *oap)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (virtual_op) {
|
if (virtual_op) {
|
||||||
int endcol = 0;
|
|
||||||
|
|
||||||
// For virtualedit: break the tabs that are partly included.
|
// For virtualedit: break the tabs that are partly included.
|
||||||
if (gchar_pos(&oap->start) == '\t') {
|
if (gchar_pos(&oap->start) == '\t') {
|
||||||
|
int endcol = 0;
|
||||||
if (u_save_cursor() == FAIL) { // save first line for undo
|
if (u_save_cursor() == FAIL) { // save first line for undo
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@@ -1820,10 +1814,7 @@ static void replace_character(int c)
|
|||||||
/// Replace a whole area with one character.
|
/// Replace a whole area with one character.
|
||||||
static int op_replace(oparg_T *oap, int c)
|
static int op_replace(oparg_T *oap, int c)
|
||||||
{
|
{
|
||||||
int n, numc;
|
int n;
|
||||||
int num_chars;
|
|
||||||
char *newp, *oldp;
|
|
||||||
colnr_T oldlen;
|
|
||||||
struct block_def bd;
|
struct block_def bd;
|
||||||
char *after_p = NULL;
|
char *after_p = NULL;
|
||||||
int had_ctrl_v_cr = false;
|
int had_ctrl_v_cr = false;
|
||||||
@@ -1848,6 +1839,11 @@ static int op_replace(oparg_T *oap, int c)
|
|||||||
|
|
||||||
// block mode replace
|
// block mode replace
|
||||||
if (oap->motion_type == kMTBlockWise) {
|
if (oap->motion_type == kMTBlockWise) {
|
||||||
|
int numc;
|
||||||
|
int num_chars;
|
||||||
|
char *newp;
|
||||||
|
char *oldp;
|
||||||
|
colnr_T oldlen;
|
||||||
bd.is_MAX = (curwin->w_curswant == MAXCOL);
|
bd.is_MAX = (curwin->w_curswant == MAXCOL);
|
||||||
for (; curwin->w_cursor.lnum <= oap->end.lnum; curwin->w_cursor.lnum++) {
|
for (; curwin->w_cursor.lnum <= oap->end.lnum; curwin->w_cursor.lnum++) {
|
||||||
curwin->w_cursor.col = 0; // make sure cursor position is valid
|
curwin->w_cursor.col = 0; // make sure cursor position is valid
|
||||||
@@ -2218,12 +2214,11 @@ bool swapchar(int op_type, pos_T *pos)
|
|||||||
/// Insert and append operators for Visual mode.
|
/// Insert and append operators for Visual mode.
|
||||||
void op_insert(oparg_T *oap, long count1)
|
void op_insert(oparg_T *oap, long count1)
|
||||||
{
|
{
|
||||||
long ins_len, pre_textlen = 0;
|
long pre_textlen = 0;
|
||||||
char *firstline, *ins_text;
|
char *firstline;
|
||||||
colnr_T ind_pre_col = 0, ind_post_col;
|
colnr_T ind_pre_col = 0;
|
||||||
int ind_pre_vcol = 0, ind_post_vcol = 0;
|
int ind_pre_vcol = 0;
|
||||||
struct block_def bd;
|
struct block_def bd;
|
||||||
int i;
|
|
||||||
pos_T t1;
|
pos_T t1;
|
||||||
|
|
||||||
// edit() changes this - record it for OP_APPEND
|
// edit() changes this - record it for OP_APPEND
|
||||||
@@ -2284,7 +2279,7 @@ void op_insert(oparg_T *oap, long count1)
|
|||||||
if (u_save_cursor() == FAIL) {
|
if (u_save_cursor() == FAIL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (i = 0; i < bd.endspaces; i++) {
|
for (int i = 0; i < bd.endspaces; i++) {
|
||||||
ins_char(' ');
|
ins_char(' ');
|
||||||
}
|
}
|
||||||
bd.textlen += bd.endspaces;
|
bd.textlen += bd.endspaces;
|
||||||
@@ -2321,12 +2316,13 @@ void op_insert(oparg_T *oap, long count1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (oap->motion_type == kMTBlockWise) {
|
if (oap->motion_type == kMTBlockWise) {
|
||||||
|
int ind_post_vcol = 0;
|
||||||
struct block_def bd2;
|
struct block_def bd2;
|
||||||
bool did_indent = false;
|
bool did_indent = false;
|
||||||
|
|
||||||
// if indent kicked in, the firstline might have changed
|
// if indent kicked in, the firstline might have changed
|
||||||
// but only do that, if the indent actually increased
|
// but only do that, if the indent actually increased
|
||||||
ind_post_col = (colnr_T)getwhitecols_curline();
|
colnr_T ind_post_col = (colnr_T)getwhitecols_curline();
|
||||||
if (curbuf->b_op_start.col > ind_pre_col && ind_post_col > ind_pre_col) {
|
if (curbuf->b_op_start.col > ind_pre_col && ind_post_col > ind_pre_col) {
|
||||||
bd.textcol += ind_post_col - ind_pre_col;
|
bd.textcol += ind_post_col - ind_pre_col;
|
||||||
ind_post_vcol = get_indent();
|
ind_post_vcol = get_indent();
|
||||||
@@ -2414,9 +2410,9 @@ void op_insert(oparg_T *oap, long count1)
|
|||||||
} else {
|
} else {
|
||||||
firstline += add;
|
firstline += add;
|
||||||
}
|
}
|
||||||
ins_len = (long)strlen(firstline) - pre_textlen - offset;
|
long ins_len = (long)strlen(firstline) - pre_textlen - offset;
|
||||||
if (pre_textlen >= 0 && ins_len > 0) {
|
if (pre_textlen >= 0 && ins_len > 0) {
|
||||||
ins_text = xstrnsave(firstline, (size_t)ins_len);
|
char *ins_text = xstrnsave(firstline, (size_t)ins_len);
|
||||||
// block handled here
|
// block handled here
|
||||||
if (u_save(oap->start.lnum, (linenr_T)(oap->end.lnum + 1)) == OK) {
|
if (u_save(oap->start.lnum, (linenr_T)(oap->end.lnum + 1)) == OK) {
|
||||||
block_insert(oap, ins_text, (oap->op_type == OP_INSERT), &bd);
|
block_insert(oap, ins_text, (oap->op_type == OP_INSERT), &bd);
|
||||||
@@ -2434,20 +2430,13 @@ void op_insert(oparg_T *oap, long count1)
|
|||||||
/// @return true if edit() returns because of a CTRL-O command
|
/// @return true if edit() returns because of a CTRL-O command
|
||||||
int op_change(oparg_T *oap)
|
int op_change(oparg_T *oap)
|
||||||
{
|
{
|
||||||
colnr_T l;
|
|
||||||
int retval;
|
int retval;
|
||||||
long offset;
|
|
||||||
linenr_T linenr;
|
|
||||||
long ins_len;
|
|
||||||
long pre_textlen = 0;
|
long pre_textlen = 0;
|
||||||
long pre_indent = 0;
|
long pre_indent = 0;
|
||||||
char *newp;
|
|
||||||
char *firstline;
|
char *firstline;
|
||||||
char *ins_text;
|
|
||||||
char *oldp;
|
|
||||||
struct block_def bd;
|
struct block_def bd;
|
||||||
|
|
||||||
l = oap->start.col;
|
colnr_T l = oap->start.col;
|
||||||
if (oap->motion_type == kMTLineWise) {
|
if (oap->motion_type == kMTLineWise) {
|
||||||
l = 0;
|
l = 0;
|
||||||
can_si = may_do_si(); // Like opening a new line, do smart indent
|
can_si = may_do_si(); // Like opening a new line, do smart indent
|
||||||
@@ -2499,6 +2488,7 @@ int op_change(oparg_T *oap)
|
|||||||
// Don't repeat the insert when Insert mode ended with CTRL-C.
|
// Don't repeat the insert when Insert mode ended with CTRL-C.
|
||||||
if (oap->motion_type == kMTBlockWise
|
if (oap->motion_type == kMTBlockWise
|
||||||
&& oap->start.lnum != oap->end.lnum && !got_int) {
|
&& oap->start.lnum != oap->end.lnum && !got_int) {
|
||||||
|
long ins_len;
|
||||||
// Auto-indenting may have changed the indent. If the cursor was past
|
// Auto-indenting may have changed the indent. If the cursor was past
|
||||||
// the indent, exclude that indent change from the inserted text.
|
// the indent, exclude that indent change from the inserted text.
|
||||||
firstline = ml_get(oap->start.lnum);
|
firstline = ml_get(oap->start.lnum);
|
||||||
@@ -2511,11 +2501,14 @@ int op_change(oparg_T *oap)
|
|||||||
|
|
||||||
ins_len = (long)strlen(firstline) - pre_textlen;
|
ins_len = (long)strlen(firstline) - pre_textlen;
|
||||||
if (ins_len > 0) {
|
if (ins_len > 0) {
|
||||||
|
long offset;
|
||||||
|
char *newp;
|
||||||
|
char *oldp;
|
||||||
// Subsequent calls to ml_get() flush the firstline data - take a
|
// Subsequent calls to ml_get() flush the firstline data - take a
|
||||||
// copy of the inserted text.
|
// copy of the inserted text.
|
||||||
ins_text = xmalloc((size_t)(ins_len + 1));
|
char *ins_text = xmalloc((size_t)(ins_len + 1));
|
||||||
xstrlcpy(ins_text, firstline + bd.textcol, (size_t)ins_len + 1);
|
xstrlcpy(ins_text, firstline + bd.textcol, (size_t)ins_len + 1);
|
||||||
for (linenr = oap->start.lnum + 1; linenr <= oap->end.lnum;
|
for (linenr_T linenr = oap->start.lnum + 1; linenr <= oap->end.lnum;
|
||||||
linenr++) {
|
linenr++) {
|
||||||
block_prep(oap, &bd, linenr, true);
|
block_prep(oap, &bd, linenr, true);
|
||||||
if (!bd.is_short || virtual_op) {
|
if (!bd.is_short || virtual_op) {
|
||||||
@@ -2619,7 +2612,6 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
|
|||||||
yankreg_T newreg; // new yank register when appending
|
yankreg_T newreg; // new yank register when appending
|
||||||
char **new_ptr;
|
char **new_ptr;
|
||||||
linenr_T lnum; // current line number
|
linenr_T lnum; // current line number
|
||||||
size_t j;
|
|
||||||
MotionType yank_type = oap->motion_type;
|
MotionType yank_type = oap->motion_type;
|
||||||
size_t yanklines = (size_t)oap->line_count;
|
size_t yanklines = (size_t)oap->line_count;
|
||||||
linenr_T yankendlnum = oap->end.lnum;
|
linenr_T yankendlnum = oap->end.lnum;
|
||||||
@@ -2743,6 +2735,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (curr != reg) { // append the new block to the old block
|
if (curr != reg) { // append the new block to the old block
|
||||||
|
size_t j;
|
||||||
new_ptr = xmalloc(sizeof(char *) * (curr->y_size + reg->y_size));
|
new_ptr = xmalloc(sizeof(char *) * (curr->y_size + reg->y_size));
|
||||||
for (j = 0; j < curr->y_size; j++) {
|
for (j = 0; j < curr->y_size; j++) {
|
||||||
new_ptr[j] = curr->y_array[j];
|
new_ptr[j] = curr->y_array[j];
|
||||||
@@ -3773,7 +3766,6 @@ void ex_display(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
yankreg_T *yb;
|
yankreg_T *yb;
|
||||||
int name;
|
|
||||||
char *arg = eap->arg;
|
char *arg = eap->arg;
|
||||||
int clen;
|
int clen;
|
||||||
int type;
|
int type;
|
||||||
@@ -3786,7 +3778,7 @@ void ex_display(exarg_T *eap)
|
|||||||
// Highlight title
|
// Highlight title
|
||||||
msg_puts_title(_("\nType Name Content"));
|
msg_puts_title(_("\nType Name Content"));
|
||||||
for (int i = -1; i < NUM_REGISTERS && !got_int; i++) {
|
for (int i = -1; i < NUM_REGISTERS && !got_int; i++) {
|
||||||
name = get_register_name(i);
|
int name = get_register_name(i);
|
||||||
switch (get_reg_type(name, NULL)) {
|
switch (get_reg_type(name, NULL)) {
|
||||||
case kMTLineWise:
|
case kMTLineWise:
|
||||||
type = 'l'; break;
|
type = 'l'; break;
|
||||||
@@ -3912,13 +3904,11 @@ void ex_display(exarg_T *eap)
|
|||||||
static void dis_msg(const char *p, bool skip_esc)
|
static void dis_msg(const char *p, bool skip_esc)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
int n;
|
int n = Columns - 6;
|
||||||
int l;
|
|
||||||
|
|
||||||
n = Columns - 6;
|
|
||||||
while (*p != NUL
|
while (*p != NUL
|
||||||
&& !(*p == ESC && skip_esc && *(p + 1) == NUL)
|
&& !(*p == ESC && skip_esc && *(p + 1) == NUL)
|
||||||
&& (n -= ptr2cells(p)) >= 0) {
|
&& (n -= ptr2cells(p)) >= 0) {
|
||||||
|
int l;
|
||||||
if ((l = utfc_ptr2len(p)) > 1) {
|
if ((l = utfc_ptr2len(p)) > 1) {
|
||||||
msg_outtrans_len(p, l);
|
msg_outtrans_len(p, l);
|
||||||
p += l;
|
p += l;
|
||||||
@@ -4389,7 +4379,6 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd)
|
|||||||
changed_lines(pos.lnum, 0, pos.lnum + 1, 0L, true);
|
changed_lines(pos.lnum, 0, pos.lnum + 1, 0L, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int one_change;
|
|
||||||
int length;
|
int length;
|
||||||
pos_T startpos;
|
pos_T startpos;
|
||||||
|
|
||||||
@@ -4429,7 +4418,7 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd)
|
|||||||
length = oap->end.col - pos.col + 1;
|
length = oap->end.col - pos.col + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
one_change = do_addsub(oap->op_type, &pos, length, amount);
|
int one_change = do_addsub(oap->op_type, &pos, length, amount);
|
||||||
if (one_change) {
|
if (one_change) {
|
||||||
// Remember the start position of the first change.
|
// Remember the start position of the first change.
|
||||||
if (change_cnt == 0) {
|
if (change_cnt == 0) {
|
||||||
@@ -5323,7 +5312,6 @@ void cursor_pos_info(dict_T *dict)
|
|||||||
char *p;
|
char *p;
|
||||||
char buf1[50];
|
char buf1[50];
|
||||||
char buf2[40];
|
char buf2[40];
|
||||||
linenr_T lnum;
|
|
||||||
varnumber_T byte_count = 0;
|
varnumber_T byte_count = 0;
|
||||||
varnumber_T bom_count = 0;
|
varnumber_T bom_count = 0;
|
||||||
varnumber_T byte_count_cursor = 0;
|
varnumber_T byte_count_cursor = 0;
|
||||||
@@ -5331,9 +5319,6 @@ void cursor_pos_info(dict_T *dict)
|
|||||||
varnumber_T char_count_cursor = 0;
|
varnumber_T char_count_cursor = 0;
|
||||||
varnumber_T word_count = 0;
|
varnumber_T word_count = 0;
|
||||||
varnumber_T word_count_cursor = 0;
|
varnumber_T word_count_cursor = 0;
|
||||||
int eol_size;
|
|
||||||
varnumber_T last_check = 100000L;
|
|
||||||
long line_count_selected = 0;
|
|
||||||
pos_T min_pos, max_pos;
|
pos_T min_pos, max_pos;
|
||||||
oparg_T oparg;
|
oparg_T oparg;
|
||||||
struct block_def bd;
|
struct block_def bd;
|
||||||
@@ -5347,6 +5332,10 @@ void cursor_pos_info(dict_T *dict)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
linenr_T lnum;
|
||||||
|
int eol_size;
|
||||||
|
varnumber_T last_check = 100000L;
|
||||||
|
long line_count_selected = 0;
|
||||||
if (get_fileformat(curbuf) == EOL_DOS) {
|
if (get_fileformat(curbuf) == EOL_DOS) {
|
||||||
eol_size = 2;
|
eol_size = 2;
|
||||||
} else {
|
} else {
|
||||||
@@ -5777,22 +5766,20 @@ typedef struct {
|
|||||||
void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
||||||
{
|
{
|
||||||
oparg_T *oap = cap->oap;
|
oparg_T *oap = cap->oap;
|
||||||
pos_T old_cursor;
|
|
||||||
bool empty_region_error;
|
|
||||||
int restart_edit_save;
|
|
||||||
int lbr_saved = curwin->w_p_lbr;
|
int lbr_saved = curwin->w_p_lbr;
|
||||||
|
|
||||||
// The visual area is remembered for redo
|
// The visual area is remembered for redo
|
||||||
static redo_VIsual_T redo_VIsual = { NUL, 0, 0, 0, 0 };
|
static redo_VIsual_T redo_VIsual = { NUL, 0, 0, 0, 0 };
|
||||||
|
|
||||||
bool include_line_break = false;
|
pos_T old_cursor = curwin->w_cursor;
|
||||||
|
|
||||||
old_cursor = curwin->w_cursor;
|
|
||||||
|
|
||||||
// If an operation is pending, handle it...
|
// If an operation is pending, handle it...
|
||||||
if ((finish_op
|
if ((finish_op
|
||||||
|| VIsual_active)
|
|| VIsual_active)
|
||||||
&& oap->op_type != OP_NOP) {
|
&& oap->op_type != OP_NOP) {
|
||||||
|
bool empty_region_error;
|
||||||
|
int restart_edit_save;
|
||||||
|
bool include_line_break = false;
|
||||||
// Yank can be redone when 'y' is in 'cpoptions', but not when yanking
|
// Yank can be redone when 'y' is in 'cpoptions', but not when yanking
|
||||||
// for the clipboard.
|
// for the clipboard.
|
||||||
const bool redo_yank = vim_strchr(p_cpo, CPO_YANK) != NULL && !gui_yank;
|
const bool redo_yank = vim_strchr(p_cpo, CPO_YANK) != NULL && !gui_yank;
|
||||||
@@ -5914,8 +5901,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
|||||||
} else if (VIsual_mode == 'v') {
|
} else if (VIsual_mode == 'v') {
|
||||||
// If 'selection' is "exclusive", backup one character for
|
// If 'selection' is "exclusive", backup one character for
|
||||||
// charwise selections.
|
// charwise selections.
|
||||||
include_line_break =
|
include_line_break = unadjust_for_sel();
|
||||||
unadjust_for_sel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oap->start = VIsual;
|
oap->start = VIsual;
|
||||||
|
@@ -113,8 +113,6 @@ static void pum_compute_size(void)
|
|||||||
void pum_display(pumitem_T *array, int size, int selected, bool array_changed, int cmd_startcol)
|
void pum_display(pumitem_T *array, int size, int selected, bool array_changed, int cmd_startcol)
|
||||||
{
|
{
|
||||||
int context_lines;
|
int context_lines;
|
||||||
int above_row;
|
|
||||||
int below_row;
|
|
||||||
int redo_count = 0;
|
int redo_count = 0;
|
||||||
int pum_win_row;
|
int pum_win_row;
|
||||||
int cursor_col;
|
int cursor_col;
|
||||||
@@ -134,8 +132,8 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
|
|||||||
pum_is_visible = true;
|
pum_is_visible = true;
|
||||||
pum_is_drawn = true;
|
pum_is_drawn = true;
|
||||||
validate_cursor_col();
|
validate_cursor_col();
|
||||||
above_row = 0;
|
int above_row = 0;
|
||||||
below_row = cmdline_row;
|
int below_row = cmdline_row;
|
||||||
|
|
||||||
// wildoptions=pum
|
// wildoptions=pum
|
||||||
if (State == MODE_CMDLINE) {
|
if (State == MODE_CMDLINE) {
|
||||||
@@ -409,17 +407,15 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
|
|||||||
void pum_redraw(void)
|
void pum_redraw(void)
|
||||||
{
|
{
|
||||||
int row = 0;
|
int row = 0;
|
||||||
int grid_col;
|
|
||||||
int attr_norm = win_hl_attr(curwin, HLF_PNI);
|
int attr_norm = win_hl_attr(curwin, HLF_PNI);
|
||||||
int attr_select = win_hl_attr(curwin, HLF_PSI);
|
int attr_select = win_hl_attr(curwin, HLF_PSI);
|
||||||
int attr_scroll = win_hl_attr(curwin, HLF_PSB);
|
int attr_scroll = win_hl_attr(curwin, HLF_PSB);
|
||||||
int attr_thumb = win_hl_attr(curwin, HLF_PST);
|
int attr_thumb = win_hl_attr(curwin, HLF_PST);
|
||||||
int attr;
|
|
||||||
int i;
|
int i;
|
||||||
int idx;
|
|
||||||
char *s;
|
char *s;
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
int totwidth, width, w;
|
int width;
|
||||||
|
int w;
|
||||||
int thumb_pos = 0;
|
int thumb_pos = 0;
|
||||||
int thumb_height = 1;
|
int thumb_height = 1;
|
||||||
int round;
|
int round;
|
||||||
@@ -485,8 +481,8 @@ void pum_redraw(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < pum_height; i++) {
|
for (i = 0; i < pum_height; i++) {
|
||||||
idx = i + pum_first;
|
int idx = i + pum_first;
|
||||||
attr = (idx == pum_selected) ? attr_select : attr_norm;
|
int attr = (idx == pum_selected) ? attr_select : attr_norm;
|
||||||
|
|
||||||
grid_puts_line_start(&pum_grid, row);
|
grid_puts_line_start(&pum_grid, row);
|
||||||
|
|
||||||
@@ -501,8 +497,8 @@ void pum_redraw(void)
|
|||||||
|
|
||||||
// Display each entry, use two spaces for a Tab.
|
// Display each entry, use two spaces for a Tab.
|
||||||
// Do this 3 times: For the main text, kind and extra info
|
// Do this 3 times: For the main text, kind and extra info
|
||||||
grid_col = col_off;
|
int grid_col = col_off;
|
||||||
totwidth = 0;
|
int totwidth = 0;
|
||||||
|
|
||||||
for (round = 1; round <= 3; round++) {
|
for (round = 1; round <= 3; round++) {
|
||||||
width = 0;
|
width = 0;
|
||||||
@@ -725,7 +721,6 @@ static bool pum_set_selected(int n, int repeat)
|
|||||||
&& (vim_strchr(p_cot, 'p') != NULL)) {
|
&& (vim_strchr(p_cot, 'p') != NULL)) {
|
||||||
win_T *curwin_save = curwin;
|
win_T *curwin_save = curwin;
|
||||||
tabpage_T *curtab_save = curtab;
|
tabpage_T *curtab_save = curtab;
|
||||||
int res = OK;
|
|
||||||
|
|
||||||
// Open a preview window. 3 lines by default. Prefer
|
// Open a preview window. 3 lines by default. Prefer
|
||||||
// 'previewheight' if set and smaller.
|
// 'previewheight' if set and smaller.
|
||||||
@@ -744,6 +739,7 @@ static bool pum_set_selected(int n, int repeat)
|
|||||||
g_do_tagpreview = 0;
|
g_do_tagpreview = 0;
|
||||||
|
|
||||||
if (curwin->w_p_pvw) {
|
if (curwin->w_p_pvw) {
|
||||||
|
int res = OK;
|
||||||
if (!resized
|
if (!resized
|
||||||
&& (curbuf->b_nwindows == 1)
|
&& (curbuf->b_nwindows == 1)
|
||||||
&& (curbuf->b_fname == NULL)
|
&& (curbuf->b_fname == NULL)
|
||||||
|
@@ -689,10 +689,8 @@ void profile_init(scriptitem_T *si)
|
|||||||
/// @param tm place to store wait time
|
/// @param tm place to store wait time
|
||||||
void script_prof_save(proftime_T *tm)
|
void script_prof_save(proftime_T *tm)
|
||||||
{
|
{
|
||||||
scriptitem_T *si;
|
|
||||||
|
|
||||||
if (current_sctx.sc_sid > 0 && current_sctx.sc_sid <= script_items.ga_len) {
|
if (current_sctx.sc_sid > 0 && current_sctx.sc_sid <= script_items.ga_len) {
|
||||||
si = &SCRIPT_ITEM(current_sctx.sc_sid);
|
scriptitem_T *si = &SCRIPT_ITEM(current_sctx.sc_sid);
|
||||||
if (si->sn_prof_on && si->sn_pr_nest++ == 0) {
|
if (si->sn_prof_on && si->sn_pr_nest++ == 0) {
|
||||||
si->sn_pr_child = profile_start();
|
si->sn_pr_child = profile_start();
|
||||||
}
|
}
|
||||||
@@ -720,12 +718,11 @@ void script_prof_restore(const proftime_T *tm)
|
|||||||
/// Dump the profiling results for all scripts in file "fd".
|
/// Dump the profiling results for all scripts in file "fd".
|
||||||
static void script_dump_profile(FILE *fd)
|
static void script_dump_profile(FILE *fd)
|
||||||
{
|
{
|
||||||
scriptitem_T *si;
|
|
||||||
FILE *sfd;
|
FILE *sfd;
|
||||||
sn_prl_T *pp;
|
sn_prl_T *pp;
|
||||||
|
|
||||||
for (int id = 1; id <= script_items.ga_len; id++) {
|
for (int id = 1; id <= script_items.ga_len; id++) {
|
||||||
si = &SCRIPT_ITEM(id);
|
scriptitem_T *si = &SCRIPT_ITEM(id);
|
||||||
if (si->sn_prof_on) {
|
if (si->sn_prof_on) {
|
||||||
fprintf(fd, "SCRIPT %s\n", si->sn_name);
|
fprintf(fd, "SCRIPT %s\n", si->sn_name);
|
||||||
if (si->sn_pr_count == 1) {
|
if (si->sn_pr_count == 1) {
|
||||||
@@ -808,7 +805,6 @@ void profile_dump(void)
|
|||||||
void script_line_start(void)
|
void script_line_start(void)
|
||||||
{
|
{
|
||||||
scriptitem_T *si;
|
scriptitem_T *si;
|
||||||
sn_prl_T *pp;
|
|
||||||
|
|
||||||
if (current_sctx.sc_sid <= 0 || current_sctx.sc_sid > script_items.ga_len) {
|
if (current_sctx.sc_sid <= 0 || current_sctx.sc_sid > script_items.ga_len) {
|
||||||
return;
|
return;
|
||||||
@@ -822,7 +818,7 @@ void script_line_start(void)
|
|||||||
while (si->sn_prl_ga.ga_len <= si->sn_prl_idx
|
while (si->sn_prl_ga.ga_len <= si->sn_prl_idx
|
||||||
&& si->sn_prl_ga.ga_len < si->sn_prl_ga.ga_maxlen) {
|
&& si->sn_prl_ga.ga_len < si->sn_prl_ga.ga_maxlen) {
|
||||||
// Zero counters for a line that was not used before.
|
// Zero counters for a line that was not used before.
|
||||||
pp = &PRL_ITEM(si, si->sn_prl_ga.ga_len);
|
sn_prl_T *pp = &PRL_ITEM(si, si->sn_prl_ga.ga_len);
|
||||||
pp->snp_count = 0;
|
pp->snp_count = 0;
|
||||||
pp->sn_prl_total = profile_zero();
|
pp->sn_prl_total = profile_zero();
|
||||||
pp->sn_prl_self = profile_zero();
|
pp->sn_prl_self = profile_zero();
|
||||||
@@ -853,7 +849,6 @@ void script_line_exec(void)
|
|||||||
void script_line_end(void)
|
void script_line_end(void)
|
||||||
{
|
{
|
||||||
scriptitem_T *si;
|
scriptitem_T *si;
|
||||||
sn_prl_T *pp;
|
|
||||||
|
|
||||||
if (current_sctx.sc_sid <= 0 || current_sctx.sc_sid > script_items.ga_len) {
|
if (current_sctx.sc_sid <= 0 || current_sctx.sc_sid > script_items.ga_len) {
|
||||||
return;
|
return;
|
||||||
@@ -862,7 +857,7 @@ void script_line_end(void)
|
|||||||
if (si->sn_prof_on && si->sn_prl_idx >= 0
|
if (si->sn_prof_on && si->sn_prl_idx >= 0
|
||||||
&& si->sn_prl_idx < si->sn_prl_ga.ga_len) {
|
&& si->sn_prl_idx < si->sn_prl_ga.ga_len) {
|
||||||
if (si->sn_prl_execed) {
|
if (si->sn_prl_execed) {
|
||||||
pp = &PRL_ITEM(si, si->sn_prl_idx);
|
sn_prl_T *pp = &PRL_ITEM(si, si->sn_prl_idx);
|
||||||
pp->snp_count++;
|
pp->snp_count++;
|
||||||
si->sn_prl_start = profile_end(si->sn_prl_start);
|
si->sn_prl_start = profile_end(si->sn_prl_start);
|
||||||
si->sn_prl_start = profile_sub_wait(si->sn_prl_wait, si->sn_prl_start);
|
si->sn_prl_start = profile_sub_wait(si->sn_prl_wait, si->sn_prl_start);
|
||||||
|
@@ -380,7 +380,7 @@ size_t spell_check(win_T *wp, char *ptr, hlf_T *attrp, int *capcol, bool docount
|
|||||||
MB_PTR_ADV(mi.mi_end);
|
MB_PTR_ADV(mi.mi_end);
|
||||||
} else if (mi.mi_result == SP_BAD
|
} else if (mi.mi_result == SP_BAD
|
||||||
&& LANGP_ENTRY(wp->w_s->b_langp, 0)->lp_slang->sl_nobreak) {
|
&& LANGP_ENTRY(wp->w_s->b_langp, 0)->lp_slang->sl_nobreak) {
|
||||||
char *p, *fp;
|
char *p;
|
||||||
int save_result = mi.mi_result;
|
int save_result = mi.mi_result;
|
||||||
|
|
||||||
// First language in 'spelllang' is NOBREAK. Find first position
|
// First language in 'spelllang' is NOBREAK. Find first position
|
||||||
@@ -388,7 +388,7 @@ size_t spell_check(win_T *wp, char *ptr, hlf_T *attrp, int *capcol, bool docount
|
|||||||
mi.mi_lp = LANGP_ENTRY(wp->w_s->b_langp, 0);
|
mi.mi_lp = LANGP_ENTRY(wp->w_s->b_langp, 0);
|
||||||
if (mi.mi_lp->lp_slang->sl_fidxs != NULL) {
|
if (mi.mi_lp->lp_slang->sl_fidxs != NULL) {
|
||||||
p = mi.mi_word;
|
p = mi.mi_word;
|
||||||
fp = mi.mi_fword;
|
char *fp = mi.mi_fword;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
MB_PTR_ADV(p);
|
MB_PTR_ADV(p);
|
||||||
MB_PTR_ADV(fp);
|
MB_PTR_ADV(fp);
|
||||||
@@ -2834,7 +2834,6 @@ static void spell_soundfold_wsal(slang_T *slang, const char *inword, char *res)
|
|||||||
int j, z;
|
int j, z;
|
||||||
int reslen;
|
int reslen;
|
||||||
int k = 0;
|
int k = 0;
|
||||||
int z0;
|
|
||||||
int k0;
|
int k0;
|
||||||
int n0;
|
int n0;
|
||||||
int pri;
|
int pri;
|
||||||
@@ -2875,7 +2874,7 @@ static void spell_soundfold_wsal(slang_T *slang, const char *inword, char *res)
|
|||||||
while ((c = word[i]) != NUL) {
|
while ((c = word[i]) != NUL) {
|
||||||
// Start with the first rule that has the character in the word.
|
// Start with the first rule that has the character in the word.
|
||||||
int n = slang->sl_sal_first[c & 0xff];
|
int n = slang->sl_sal_first[c & 0xff];
|
||||||
z0 = 0;
|
int z0 = 0;
|
||||||
|
|
||||||
if (n >= 0) {
|
if (n >= 0) {
|
||||||
// Check all rules for the same index byte.
|
// Check all rules for the same index byte.
|
||||||
|
@@ -1385,7 +1385,6 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
|
|||||||
int c;
|
int c;
|
||||||
int atstart;
|
int atstart;
|
||||||
int cnt;
|
int cnt;
|
||||||
garray_T *gap;
|
|
||||||
|
|
||||||
if (todo < 2) {
|
if (todo < 2) {
|
||||||
return SP_FORMERROR; // need at least two bytes
|
return SP_FORMERROR; // need at least two bytes
|
||||||
@@ -1420,7 +1419,7 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
|
|||||||
todo--;
|
todo--;
|
||||||
slang->sl_compoptions = c;
|
slang->sl_compoptions = c;
|
||||||
|
|
||||||
gap = &slang->sl_comppat;
|
garray_T *gap = &slang->sl_comppat;
|
||||||
c = get2c(fd); // <comppatcount>
|
c = get2c(fd); // <comppatcount>
|
||||||
if (c < 0) {
|
if (c < 0) {
|
||||||
return SP_TRUNCERROR;
|
return SP_TRUNCERROR;
|
||||||
@@ -1612,7 +1611,6 @@ static void set_sal_first(slang_T *lp)
|
|||||||
{
|
{
|
||||||
salfirst_T *sfirst;
|
salfirst_T *sfirst;
|
||||||
salitem_T *smp;
|
salitem_T *smp;
|
||||||
int c;
|
|
||||||
garray_T *gap = &lp->sl_sal;
|
garray_T *gap = &lp->sl_sal;
|
||||||
|
|
||||||
sfirst = lp->sl_sal_first;
|
sfirst = lp->sl_sal_first;
|
||||||
@@ -1624,7 +1622,7 @@ static void set_sal_first(slang_T *lp)
|
|||||||
// Use the lowest byte of the first character. For latin1 it's
|
// Use the lowest byte of the first character. For latin1 it's
|
||||||
// the character, for other encodings it should differ for most
|
// the character, for other encodings it should differ for most
|
||||||
// characters.
|
// characters.
|
||||||
c = *smp[i].sm_lead_w & 0xff;
|
int c = *smp[i].sm_lead_w & 0xff;
|
||||||
if (sfirst[c] == -1) {
|
if (sfirst[c] == -1) {
|
||||||
sfirst[c] = i;
|
sfirst[c] = i;
|
||||||
|
|
||||||
@@ -1738,7 +1736,6 @@ static idx_T read_tree_node(FILE *fd, char_u *byts, idx_T *idxs, int maxidx, idx
|
|||||||
int i;
|
int i;
|
||||||
int n;
|
int n;
|
||||||
idx_T idx = startidx;
|
idx_T idx = startidx;
|
||||||
int c;
|
|
||||||
int c2;
|
int c2;
|
||||||
#define SHARED_MASK 0x8000000
|
#define SHARED_MASK 0x8000000
|
||||||
|
|
||||||
@@ -1754,7 +1751,7 @@ static idx_T read_tree_node(FILE *fd, char_u *byts, idx_T *idxs, int maxidx, idx
|
|||||||
|
|
||||||
// Read the byte values, flag/region bytes and shared indexes.
|
// Read the byte values, flag/region bytes and shared indexes.
|
||||||
for (i = 1; i <= len; i++) {
|
for (i = 1; i <= len; i++) {
|
||||||
c = getc(fd); // <byte>
|
int c = getc(fd); // <byte>
|
||||||
if (c < 0) {
|
if (c < 0) {
|
||||||
return SP_TRUNCERROR;
|
return SP_TRUNCERROR;
|
||||||
}
|
}
|
||||||
@@ -2434,7 +2431,6 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
|||||||
&& strcmp(cur_aff->ah_key, items[1]) == 0
|
&& strcmp(cur_aff->ah_key, items[1]) == 0
|
||||||
&& itemcnt >= 5) {
|
&& itemcnt >= 5) {
|
||||||
affentry_T *aff_entry;
|
affentry_T *aff_entry;
|
||||||
bool upper = false;
|
|
||||||
int lasti = 5;
|
int lasti = 5;
|
||||||
|
|
||||||
// Myspell allows extra text after the item, but that might
|
// Myspell allows extra text after the item, but that might
|
||||||
@@ -2493,6 +2489,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
|||||||
// COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG.
|
// COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG.
|
||||||
if (*items[0] == 'P' && aff->af_pfxpostpone
|
if (*items[0] == 'P' && aff->af_pfxpostpone
|
||||||
&& aff_entry->ae_flags == NULL) {
|
&& aff_entry->ae_flags == NULL) {
|
||||||
|
bool upper = false;
|
||||||
// When the chop string is one lower-case letter and
|
// When the chop string is one lower-case letter and
|
||||||
// the add string ends in the upper-case letter we set
|
// the add string ends in the upper-case letter we set
|
||||||
// the "upper" flag, clear "ae_chop" and remove the
|
// the "upper" flag, clear "ae_chop" and remove the
|
||||||
@@ -2502,10 +2499,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
|||||||
&& aff_entry->ae_add != NULL
|
&& aff_entry->ae_add != NULL
|
||||||
&& aff_entry->ae_chop[utfc_ptr2len(aff_entry->ae_chop)] ==
|
&& aff_entry->ae_chop[utfc_ptr2len(aff_entry->ae_chop)] ==
|
||||||
NUL) {
|
NUL) {
|
||||||
int c, c_up;
|
int c = utf_ptr2char(aff_entry->ae_chop);
|
||||||
|
int c_up = SPELL_TOUPPER(c);
|
||||||
c = utf_ptr2char(aff_entry->ae_chop);
|
|
||||||
c_up = SPELL_TOUPPER(c);
|
|
||||||
if (c_up != c
|
if (c_up != c
|
||||||
&& (aff_entry->ae_cond == NULL
|
&& (aff_entry->ae_cond == NULL
|
||||||
|| utf_ptr2char(aff_entry->ae_cond) == c)) {
|
|| utf_ptr2char(aff_entry->ae_cond) == c)) {
|
||||||
@@ -2535,8 +2530,6 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
|||||||
|
|
||||||
if (aff_entry->ae_chop == NULL) {
|
if (aff_entry->ae_chop == NULL) {
|
||||||
int idx;
|
int idx;
|
||||||
char_u **pp;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
// Find a previously used condition.
|
// Find a previously used condition.
|
||||||
for (idx = spin->si_prefcond.ga_len - 1; idx >= 0; idx--) {
|
for (idx = spin->si_prefcond.ga_len - 1; idx >= 0; idx--) {
|
||||||
@@ -2548,7 +2541,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
|||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
// Not found, add a new condition.
|
// Not found, add a new condition.
|
||||||
idx = spin->si_prefcond.ga_len;
|
idx = spin->si_prefcond.ga_len;
|
||||||
pp = GA_APPEND_VIA_PTR(char_u *, &spin->si_prefcond);
|
char_u **pp = GA_APPEND_VIA_PTR(char_u *, &spin->si_prefcond);
|
||||||
*pp = (aff_entry->ae_cond == NULL) ?
|
*pp = (aff_entry->ae_cond == NULL) ?
|
||||||
NULL : (char_u *)getroom_save(spin, aff_entry->ae_cond);
|
NULL : (char_u *)getroom_save(spin, aff_entry->ae_cond);
|
||||||
}
|
}
|
||||||
@@ -2562,7 +2555,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
|||||||
|
|
||||||
// PFX_FLAGS is a negative number, so that
|
// PFX_FLAGS is a negative number, so that
|
||||||
// tree_add_word() knows this is the prefix tree.
|
// tree_add_word() knows this is the prefix tree.
|
||||||
n = PFX_FLAGS;
|
int n = PFX_FLAGS;
|
||||||
if (!cur_aff->ah_combine) {
|
if (!cur_aff->ah_combine) {
|
||||||
n |= WFP_NC;
|
n |= WFP_NC;
|
||||||
}
|
}
|
||||||
@@ -2636,11 +2629,9 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
|||||||
fname, lnum);
|
fname, lnum);
|
||||||
}
|
}
|
||||||
} else if (do_mapline) {
|
} else if (do_mapline) {
|
||||||
int c;
|
|
||||||
|
|
||||||
// Check that every character appears only once.
|
// Check that every character appears only once.
|
||||||
for (p = items[1]; *p != NUL;) {
|
for (p = items[1]; *p != NUL;) {
|
||||||
c = mb_ptr2char_adv((const char **)&p);
|
int c = mb_ptr2char_adv((const char **)&p);
|
||||||
if ((!GA_EMPTY(&spin->si_map)
|
if ((!GA_EMPTY(&spin->si_map)
|
||||||
&& vim_strchr(spin->si_map.ga_data, c)
|
&& vim_strchr(spin->si_map.ga_data, c)
|
||||||
!= NULL)
|
!= NULL)
|
||||||
@@ -2791,14 +2782,12 @@ static bool is_aff_rule(char **items, int itemcnt, char *rulename, int mincount)
|
|||||||
static void aff_process_flags(afffile_T *affile, affentry_T *entry)
|
static void aff_process_flags(afffile_T *affile, affentry_T *entry)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
char_u *prevp;
|
|
||||||
unsigned flag;
|
|
||||||
|
|
||||||
if (entry->ae_flags != NULL
|
if (entry->ae_flags != NULL
|
||||||
&& (affile->af_compforbid != 0 || affile->af_comppermit != 0)) {
|
&& (affile->af_compforbid != 0 || affile->af_comppermit != 0)) {
|
||||||
for (p = entry->ae_flags; *p != NUL;) {
|
for (p = entry->ae_flags; *p != NUL;) {
|
||||||
prevp = (char_u *)p;
|
char_u *prevp = (char_u *)p;
|
||||||
flag = get_affitem(affile->af_flagtype, &p);
|
unsigned flag = get_affitem(affile->af_flagtype, &p);
|
||||||
if (flag == affile->af_comppermit || flag == affile->af_compforbid) {
|
if (flag == affile->af_comppermit || flag == affile->af_compforbid) {
|
||||||
STRMOVE(prevp, (char *)p);
|
STRMOVE(prevp, (char *)p);
|
||||||
p = (char *)prevp;
|
p = (char *)prevp;
|
||||||
@@ -2833,10 +2822,9 @@ static bool spell_info_item(char *s)
|
|||||||
// returns zero for failure.
|
// returns zero for failure.
|
||||||
static unsigned affitem2flag(int flagtype, char *item, char *fname, int lnum)
|
static unsigned affitem2flag(int flagtype, char *item, char *fname, int lnum)
|
||||||
{
|
{
|
||||||
unsigned res;
|
|
||||||
char *p = item;
|
char *p = item;
|
||||||
|
|
||||||
res = get_affitem(flagtype, &p);
|
unsigned res = get_affitem(flagtype, &p);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
if (flagtype == AFT_NUM) {
|
if (flagtype == AFT_NUM) {
|
||||||
smsg(_("Flag is not a number in %s line %d: %s"),
|
smsg(_("Flag is not a number in %s line %d: %s"),
|
||||||
@@ -2889,30 +2877,27 @@ static unsigned get_affitem(int flagtype, char **pp)
|
|||||||
/// they fit in one byte.
|
/// they fit in one byte.
|
||||||
static void process_compflags(spellinfo_T *spin, afffile_T *aff, char *compflags)
|
static void process_compflags(spellinfo_T *spin, afffile_T *aff, char *compflags)
|
||||||
{
|
{
|
||||||
char *p;
|
|
||||||
char *prevp;
|
char *prevp;
|
||||||
unsigned flag;
|
unsigned flag;
|
||||||
compitem_T *ci;
|
compitem_T *ci;
|
||||||
int id;
|
int id;
|
||||||
int len;
|
|
||||||
char_u *tp;
|
|
||||||
char key[AH_KEY_LEN];
|
char key[AH_KEY_LEN];
|
||||||
hashitem_T *hi;
|
hashitem_T *hi;
|
||||||
|
|
||||||
// Make room for the old and the new compflags, concatenated with a / in
|
// Make room for the old and the new compflags, concatenated with a / in
|
||||||
// between. Processing it makes it shorter, but we don't know by how
|
// between. Processing it makes it shorter, but we don't know by how
|
||||||
// much, thus allocate the maximum.
|
// much, thus allocate the maximum.
|
||||||
len = (int)strlen(compflags) + 1;
|
int len = (int)strlen(compflags) + 1;
|
||||||
if (spin->si_compflags != NULL) {
|
if (spin->si_compflags != NULL) {
|
||||||
len += (int)strlen(spin->si_compflags) + 1;
|
len += (int)strlen(spin->si_compflags) + 1;
|
||||||
}
|
}
|
||||||
p = getroom(spin, (size_t)len, false);
|
char *p = getroom(spin, (size_t)len, false);
|
||||||
if (spin->si_compflags != NULL) {
|
if (spin->si_compflags != NULL) {
|
||||||
STRCPY(p, spin->si_compflags);
|
STRCPY(p, spin->si_compflags);
|
||||||
STRCAT(p, "/");
|
STRCAT(p, "/");
|
||||||
}
|
}
|
||||||
spin->si_compflags = p;
|
spin->si_compflags = p;
|
||||||
tp = (char_u *)p + strlen(p);
|
char_u *tp = (char_u *)p + strlen(p);
|
||||||
|
|
||||||
for (p = compflags; *p != NUL;) {
|
for (p = compflags; *p != NUL;) {
|
||||||
if (vim_strchr("/?*+[]", (uint8_t)(*p)) != NULL) {
|
if (vim_strchr("/?*+[]", (uint8_t)(*p)) != NULL) {
|
||||||
@@ -3061,7 +3046,6 @@ static void spell_free_aff(afffile_T *aff)
|
|||||||
{
|
{
|
||||||
hashtab_T *ht;
|
hashtab_T *ht;
|
||||||
hashitem_T *hi;
|
hashitem_T *hi;
|
||||||
int todo;
|
|
||||||
affheader_T *ah;
|
affheader_T *ah;
|
||||||
affentry_T *ae;
|
affentry_T *ae;
|
||||||
|
|
||||||
@@ -3069,7 +3053,7 @@ static void spell_free_aff(afffile_T *aff)
|
|||||||
|
|
||||||
// All this trouble to free the "ae_prog" items...
|
// All this trouble to free the "ae_prog" items...
|
||||||
for (ht = &aff->af_pref;; ht = &aff->af_suff) {
|
for (ht = &aff->af_pref;; ht = &aff->af_suff) {
|
||||||
todo = (int)ht->ht_used;
|
int todo = (int)ht->ht_used;
|
||||||
for (hi = ht->ht_array; todo > 0; hi++) {
|
for (hi = ht->ht_array; todo > 0; hi++) {
|
||||||
if (!HASHITEM_EMPTY(hi)) {
|
if (!HASHITEM_EMPTY(hi)) {
|
||||||
todo--;
|
todo--;
|
||||||
@@ -3106,7 +3090,6 @@ static int spell_read_dic(spellinfo_T *spin, char *fname, afffile_T *affile)
|
|||||||
int l;
|
int l;
|
||||||
hash_T hash;
|
hash_T hash;
|
||||||
hashitem_T *hi;
|
hashitem_T *hi;
|
||||||
FILE *fd;
|
|
||||||
int lnum = 1;
|
int lnum = 1;
|
||||||
int non_ascii = 0;
|
int non_ascii = 0;
|
||||||
int retval = OK;
|
int retval = OK;
|
||||||
@@ -3116,7 +3099,7 @@ static int spell_read_dic(spellinfo_T *spin, char *fname, afffile_T *affile)
|
|||||||
Timestamp last_msg_time = 0;
|
Timestamp last_msg_time = 0;
|
||||||
|
|
||||||
// Open the file.
|
// Open the file.
|
||||||
fd = os_fopen(fname, "r");
|
FILE *fd = os_fopen(fname, "r");
|
||||||
if (fd == NULL) {
|
if (fd == NULL) {
|
||||||
semsg(_(e_notopen), fname);
|
semsg(_(e_notopen), fname);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@@ -3340,15 +3323,13 @@ static int get_affix_flags(afffile_T *affile, char *afflist)
|
|||||||
// and return the number of affixes.
|
// and return the number of affixes.
|
||||||
static int get_pfxlist(afffile_T *affile, char *afflist, char_u *store_afflist)
|
static int get_pfxlist(afffile_T *affile, char *afflist, char_u *store_afflist)
|
||||||
{
|
{
|
||||||
char *p;
|
|
||||||
char *prevp;
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int id;
|
int id;
|
||||||
char key[AH_KEY_LEN];
|
char key[AH_KEY_LEN];
|
||||||
hashitem_T *hi;
|
hashitem_T *hi;
|
||||||
|
|
||||||
for (p = afflist; *p != NUL;) {
|
for (char *p = afflist; *p != NUL;) {
|
||||||
prevp = p;
|
char *prevp = p;
|
||||||
if (get_affitem(affile->af_flagtype, &p) != 0) {
|
if (get_affitem(affile->af_flagtype, &p) != 0) {
|
||||||
// A flag is a postponed prefix flag if it appears in "af_pref"
|
// A flag is a postponed prefix flag if it appears in "af_pref"
|
||||||
// and its ID is not zero.
|
// and its ID is not zero.
|
||||||
@@ -3375,14 +3356,12 @@ static int get_pfxlist(afffile_T *affile, char *afflist, char_u *store_afflist)
|
|||||||
// Puts the flags in "store_afflist[]".
|
// Puts the flags in "store_afflist[]".
|
||||||
static void get_compflags(afffile_T *affile, char *afflist, char_u *store_afflist)
|
static void get_compflags(afffile_T *affile, char *afflist, char_u *store_afflist)
|
||||||
{
|
{
|
||||||
char *p;
|
|
||||||
char *prevp;
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
char key[AH_KEY_LEN];
|
char key[AH_KEY_LEN];
|
||||||
hashitem_T *hi;
|
hashitem_T *hi;
|
||||||
|
|
||||||
for (p = afflist; *p != NUL;) {
|
for (char *p = afflist; *p != NUL;) {
|
||||||
prevp = p;
|
char *prevp = p;
|
||||||
if (get_affitem(affile->af_flagtype, &p) != 0) {
|
if (get_affitem(affile->af_flagtype, &p) != 0) {
|
||||||
// A flag is a compound flag if it appears in "af_comp".
|
// A flag is a compound flag if it appears in "af_comp".
|
||||||
xstrlcpy(key, prevp, (size_t)(p - prevp) + 1);
|
xstrlcpy(key, prevp, (size_t)(p - prevp) + 1);
|
||||||
@@ -3418,7 +3397,6 @@ static int store_aff_word(spellinfo_T *spin, char *word, char *afflist, afffile_
|
|||||||
hashtab_T *ht, hashtab_T *xht, int condit, int flags, char *pfxlist,
|
hashtab_T *ht, hashtab_T *xht, int condit, int flags, char *pfxlist,
|
||||||
int pfxlen)
|
int pfxlen)
|
||||||
{
|
{
|
||||||
int todo;
|
|
||||||
hashitem_T *hi;
|
hashitem_T *hi;
|
||||||
affheader_T *ah;
|
affheader_T *ah;
|
||||||
affentry_T *ae;
|
affentry_T *ae;
|
||||||
@@ -3435,7 +3413,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char *afflist, afffile_
|
|||||||
size_t wordlen = strlen(word);
|
size_t wordlen = strlen(word);
|
||||||
int use_condit;
|
int use_condit;
|
||||||
|
|
||||||
todo = (int)ht->ht_used;
|
int todo = (int)ht->ht_used;
|
||||||
for (hi = ht->ht_array; todo > 0 && retval == OK; hi++) {
|
for (hi = ht->ht_array; todo > 0 && retval == OK; hi++) {
|
||||||
if (!HASHITEM_EMPTY(hi)) {
|
if (!HASHITEM_EMPTY(hi)) {
|
||||||
todo--;
|
todo--;
|
||||||
@@ -4414,7 +4392,6 @@ static int write_vim_spell(spellinfo_T *spin, char *fname)
|
|||||||
// the table (avoids that it conflicts). File is shorter too.
|
// the table (avoids that it conflicts). File is shorter too.
|
||||||
if (!spin->si_ascii && !spin->si_add) {
|
if (!spin->si_ascii && !spin->si_add) {
|
||||||
char folchars[128 * 8];
|
char folchars[128 * 8];
|
||||||
int flags;
|
|
||||||
|
|
||||||
putc(SN_CHARFLAGS, fd); // <sectionID>
|
putc(SN_CHARFLAGS, fd); // <sectionID>
|
||||||
putc(SNF_REQUIRED, fd); // <sectionflags>
|
putc(SNF_REQUIRED, fd); // <sectionflags>
|
||||||
@@ -4428,7 +4405,7 @@ static int write_vim_spell(spellinfo_T *spin, char *fname)
|
|||||||
|
|
||||||
fputc(128, fd); // <charflagslen>
|
fputc(128, fd); // <charflagslen>
|
||||||
for (size_t i = 128; i < 256; i++) {
|
for (size_t i = 128; i < 256; i++) {
|
||||||
flags = 0;
|
int flags = 0;
|
||||||
if (spelltab.st_isw[i]) {
|
if (spelltab.st_isw[i]) {
|
||||||
flags |= CF_WORD;
|
flags |= CF_WORD;
|
||||||
}
|
}
|
||||||
@@ -5528,8 +5505,6 @@ void spell_add_word(char *word, int len, SpellAddType what, int idx, bool undo)
|
|||||||
char *fname;
|
char *fname;
|
||||||
char *fnamebuf = NULL;
|
char *fnamebuf = NULL;
|
||||||
char line[MAXWLEN * 2];
|
char line[MAXWLEN * 2];
|
||||||
long fpos, fpos_next = 0;
|
|
||||||
int i;
|
|
||||||
char *spf;
|
char *spf;
|
||||||
|
|
||||||
if (!valid_spell_word(word, word + len)) {
|
if (!valid_spell_word(word, word + len)) {
|
||||||
@@ -5546,6 +5521,7 @@ void spell_add_word(char *word, int len, SpellAddType what, int idx, bool undo)
|
|||||||
}
|
}
|
||||||
fname = int_wordlist;
|
fname = int_wordlist;
|
||||||
} else {
|
} else {
|
||||||
|
int i;
|
||||||
// If 'spellfile' isn't set figure out a good default value.
|
// If 'spellfile' isn't set figure out a good default value.
|
||||||
if (*curwin->w_s->b_p_spf == NUL) {
|
if (*curwin->w_s->b_p_spf == NUL) {
|
||||||
init_spellfile();
|
init_spellfile();
|
||||||
@@ -5585,6 +5561,8 @@ void spell_add_word(char *word, int len, SpellAddType what, int idx, bool undo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (what == SPELL_ADD_BAD || undo) {
|
if (what == SPELL_ADD_BAD || undo) {
|
||||||
|
long fpos_next = 0;
|
||||||
|
long fpos = 0;
|
||||||
// When the word appears as good word we need to remove that one,
|
// When the word appears as good word we need to remove that one,
|
||||||
// since its flags sort before the one with WF_BANNED.
|
// since its flags sort before the one with WF_BANNED.
|
||||||
fd = os_fopen(fname, "r");
|
fd = os_fopen(fname, "r");
|
||||||
@@ -5784,11 +5762,9 @@ static void set_spell_charflags(const char_u *flags, int cnt, char *fol)
|
|||||||
|
|
||||||
static int set_spell_finish(spelltab_T *new_st)
|
static int set_spell_finish(spelltab_T *new_st)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
if (did_set_spelltab) {
|
if (did_set_spelltab) {
|
||||||
// check that it's the same table
|
// check that it's the same table
|
||||||
for (i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
if (spelltab.st_isw[i] != new_st->st_isw[i]
|
if (spelltab.st_isw[i] != new_st->st_isw[i]
|
||||||
|| spelltab.st_isu[i] != new_st->st_isu[i]
|
|| spelltab.st_isu[i] != new_st->st_isu[i]
|
||||||
|| spelltab.st_fold[i] != new_st->st_fold[i]
|
|| spelltab.st_fold[i] != new_st->st_fold[i]
|
||||||
@@ -5841,7 +5817,6 @@ static void set_map_str(slang_T *lp, char *map)
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int headc = 0;
|
int headc = 0;
|
||||||
int c;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (*map == NUL) {
|
if (*map == NUL) {
|
||||||
@@ -5860,7 +5835,7 @@ static void set_map_str(slang_T *lp, char *map)
|
|||||||
// "aaa/bbb/ccc/". Fill sl_map_array[c] with the character before c and
|
// "aaa/bbb/ccc/". Fill sl_map_array[c] with the character before c and
|
||||||
// before the same slash. For characters above 255 sl_map_hash is used.
|
// before the same slash. For characters above 255 sl_map_hash is used.
|
||||||
for (p = map; *p != NUL;) {
|
for (p = map; *p != NUL;) {
|
||||||
c = mb_cptr2char_adv((const char **)&p);
|
int c = mb_cptr2char_adv((const char **)&p);
|
||||||
if (c == '/') {
|
if (c == '/') {
|
||||||
headc = 0;
|
headc = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -358,14 +358,13 @@ newwindow:
|
|||||||
msg(_(m_onlyone));
|
msg(_(m_onlyone));
|
||||||
} else {
|
} else {
|
||||||
tabpage_T *oldtab = curtab;
|
tabpage_T *oldtab = curtab;
|
||||||
tabpage_T *newtab;
|
|
||||||
|
|
||||||
// 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((int)Prenum, NULL) == OK
|
||||||
&& valid_tabpage(oldtab)) {
|
&& valid_tabpage(oldtab)) {
|
||||||
newtab = curtab;
|
tabpage_T *newtab = curtab;
|
||||||
goto_tabpage_tp(oldtab, true, true);
|
goto_tabpage_tp(oldtab, true, true);
|
||||||
if (curwin == wp) {
|
if (curwin == wp) {
|
||||||
win_close(curwin, false, false);
|
win_close(curwin, false, false);
|
||||||
|
Reference in New Issue
Block a user