mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #1661 from philix/early_exit
Reduce indentation level by early returning or continuing loop
This commit is contained in:
commit
ec6afbf4e6
@ -238,7 +238,10 @@ open_buffer (
|
|||||||
}
|
}
|
||||||
apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval);
|
apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval);
|
||||||
|
|
||||||
if (retval != FAIL) {
|
if (retval == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The autocommands may have changed the current buffer. Apply the
|
* The autocommands may have changed the current buffer. Apply the
|
||||||
* modelines to the correct buffer, if it still exists and is loaded.
|
* modelines to the correct buffer, if it still exists and is loaded.
|
||||||
@ -257,7 +260,6 @@ open_buffer (
|
|||||||
/* restore curwin/curbuf and a few other things */
|
/* restore curwin/curbuf and a few other things */
|
||||||
aucmd_restbuf(&aco);
|
aucmd_restbuf(&aco);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -2103,14 +2105,10 @@ void get_winopts(buf_T *buf)
|
|||||||
*/
|
*/
|
||||||
pos_T *buflist_findfpos(buf_T *buf)
|
pos_T *buflist_findfpos(buf_T *buf)
|
||||||
{
|
{
|
||||||
wininfo_T *wip;
|
|
||||||
static pos_T no_position = INIT_POS_T(1, 0, 0);
|
static pos_T no_position = INIT_POS_T(1, 0, 0);
|
||||||
|
|
||||||
wip = find_wininfo(buf, FALSE);
|
wininfo_T *wip = find_wininfo(buf, FALSE);
|
||||||
if (wip != NULL)
|
return (wip == NULL) ? &no_position : &(wip->wi_fpos);
|
||||||
return &(wip->wi_fpos);
|
|
||||||
else
|
|
||||||
return &no_position;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4091,7 +4089,10 @@ chk_modeline (
|
|||||||
prev = *s;
|
prev = *s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*s) {
|
if (!*s) {
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
do /* skip over "ex:", "vi:" or "vim:" */
|
do /* skip over "ex:", "vi:" or "vim:" */
|
||||||
++s;
|
++s;
|
||||||
while (s[-1] != ':');
|
while (s[-1] != ':');
|
||||||
@ -4150,7 +4151,7 @@ chk_modeline (
|
|||||||
sourcing_name = save_sourcing_name;
|
sourcing_name = save_sourcing_name;
|
||||||
|
|
||||||
free(linecopy);
|
free(linecopy);
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +579,9 @@ static int diff_check_sanity(tabpage_T *tp, diff_T *dp)
|
|||||||
static void diff_redraw(int dofold)
|
static void diff_redraw(int dofold)
|
||||||
{
|
{
|
||||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||||
if (wp->w_p_diff) {
|
if (!wp->w_p_diff) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
redraw_win_later(wp, SOME_VALID);
|
redraw_win_later(wp, SOME_VALID);
|
||||||
if (dofold && foldmethodIsDiff(wp)) {
|
if (dofold && foldmethodIsDiff(wp)) {
|
||||||
foldUpdateAll(wp);
|
foldUpdateAll(wp);
|
||||||
@ -598,7 +600,6 @@ static void diff_redraw(int dofold)
|
|||||||
check_topfill(wp, FALSE);
|
check_topfill(wp, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write buffer "buf" to file "name".
|
/// Write buffer "buf" to file "name".
|
||||||
|
@ -2565,7 +2565,9 @@ static void ins_compl_files(int count, char_u **files, int thesaurus, int flags,
|
|||||||
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
|
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fp != NULL) {
|
if (fp == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Read dictionary file line by line.
|
* Read dictionary file line by line.
|
||||||
* Check each line for a match.
|
* Check each line for a match.
|
||||||
@ -2634,7 +2636,6 @@ static void ins_compl_files(int count, char_u **files, int thesaurus, int flags,
|
|||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -7027,7 +7028,9 @@ static void ins_ctrl_(void)
|
|||||||
*/
|
*/
|
||||||
static int ins_start_select(int c)
|
static int ins_start_select(int c)
|
||||||
{
|
{
|
||||||
if (km_startsel)
|
if (!km_startsel) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case K_KHOME:
|
case K_KHOME:
|
||||||
case K_KEND:
|
case K_KEND:
|
||||||
|
@ -5987,7 +5987,9 @@ static char_u *dict2string(typval_T *tv, int copyID)
|
|||||||
|
|
||||||
todo = (int)d->dv_hashtab.ht_used;
|
todo = (int)d->dv_hashtab.ht_used;
|
||||||
for (hi = d->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) {
|
for (hi = d->dv_hashtab.ht_array; todo > 0 && !got_int; ++hi) {
|
||||||
if (!HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
--todo;
|
--todo;
|
||||||
|
|
||||||
if (first)
|
if (first)
|
||||||
@ -6010,7 +6012,6 @@ static char_u *dict2string(typval_T *tv, int copyID)
|
|||||||
}
|
}
|
||||||
line_breakcheck();
|
line_breakcheck();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (todo > 0) {
|
if (todo > 0) {
|
||||||
free(ga.ga_data);
|
free(ga.ga_data);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2375,7 +2375,9 @@ void do_wqall(exarg_T *eap)
|
|||||||
exiting = TRUE;
|
exiting = TRUE;
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
if (bufIsChanged(buf)) {
|
if (!bufIsChanged(buf)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Check if there is a reason the buffer cannot be written:
|
* Check if there is a reason the buffer cannot be written:
|
||||||
* 1. if the 'write' option is set
|
* 1. if the 'write' option is set
|
||||||
@ -2403,7 +2405,6 @@ void do_wqall(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
eap->forceit = save_forceit; /* check_overwrite() may set it */
|
eap->forceit = save_forceit; /* check_overwrite() may set it */
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (exiting) {
|
if (exiting) {
|
||||||
if (!error)
|
if (!error)
|
||||||
getout(0); /* exit Vim */
|
getout(0); /* exit Vim */
|
||||||
@ -3328,13 +3329,12 @@ void ex_z(exarg_T *eap)
|
|||||||
if (!VIM_ISDIGIT(*x)) {
|
if (!VIM_ISDIGIT(*x)) {
|
||||||
EMSG(_("E144: non-numeric argument to :z"));
|
EMSG(_("E144: non-numeric argument to :z"));
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
bigness = atoi((char *)x);
|
bigness = atoi((char *)x);
|
||||||
p_window = bigness;
|
p_window = bigness;
|
||||||
if (*kind == '=')
|
if (*kind == '=')
|
||||||
bigness += 2;
|
bigness += 2;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* the number of '-' and '+' multiplies the distance */
|
/* the number of '-' and '+' multiplies the distance */
|
||||||
if (*kind == '-' || *kind == '+')
|
if (*kind == '-' || *kind == '+')
|
||||||
@ -5232,7 +5232,9 @@ void fix_help_buffer(void)
|
|||||||
if (fnames[fi] == NULL)
|
if (fnames[fi] == NULL)
|
||||||
continue;
|
continue;
|
||||||
fd = mch_fopen((char *)fnames[fi], "r");
|
fd = mch_fopen((char *)fnames[fi], "r");
|
||||||
if (fd != NULL) {
|
if (fd == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
vim_fgets(IObuff, IOSIZE, fd);
|
vim_fgets(IObuff, IOSIZE, fd);
|
||||||
if (IObuff[0] == '*'
|
if (IObuff[0] == '*'
|
||||||
&& (s = vim_strchr(IObuff + 1, '*'))
|
&& (s = vim_strchr(IObuff + 1, '*'))
|
||||||
@ -5287,7 +5289,6 @@ void fix_help_buffer(void)
|
|||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
FreeWild(fcount, fnames);
|
FreeWild(fcount, fnames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5368,7 +5369,9 @@ void ex_helptags(exarg_T *eap)
|
|||||||
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]);
|
len = (int)STRLEN(files[i]);
|
||||||
if (len > 4) {
|
if (len <= 4) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (STRICMP(files[i] + len - 4, ".txt") == 0) {
|
if (STRICMP(files[i] + len - 4, ".txt") == 0) {
|
||||||
/* ".txt" -> language "en" */
|
/* ".txt" -> language "en" */
|
||||||
lang[0] = 'e';
|
lang[0] = 'e';
|
||||||
@ -5395,7 +5398,6 @@ void ex_helptags(exarg_T *eap)
|
|||||||
((char_u *)ga.ga_data)[ga.ga_len++] = lang[1];
|
((char_u *)ga.ga_data)[ga.ga_len++] = lang[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop over the found languages to generate a tags file for each one.
|
* Loop over the found languages to generate a tags file for each one.
|
||||||
|
@ -7748,7 +7748,9 @@ static char_u *arg_all(void)
|
|||||||
len = 0;
|
len = 0;
|
||||||
for (idx = 0; idx < ARGCOUNT; ++idx) {
|
for (idx = 0; idx < ARGCOUNT; ++idx) {
|
||||||
p = alist_name(&ARGLIST[idx]);
|
p = alist_name(&ARGLIST[idx]);
|
||||||
if (p != NULL) {
|
if (p == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
/* insert a space in between names */
|
/* insert a space in between names */
|
||||||
if (retval != NULL)
|
if (retval != NULL)
|
||||||
@ -7767,7 +7769,6 @@ static char_u *arg_all(void)
|
|||||||
++len;
|
++len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* second time: break here */
|
/* second time: break here */
|
||||||
if (retval != NULL) {
|
if (retval != NULL) {
|
||||||
|
@ -246,9 +246,7 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore)
|
|||||||
plist = &(*plist)->next;
|
plist = &(*plist)->next;
|
||||||
|
|
||||||
elem = xmalloc(sizeof(struct msglist));
|
elem = xmalloc(sizeof(struct msglist));
|
||||||
{
|
|
||||||
elem->msg = vim_strsave(mesg);
|
elem->msg = vim_strsave(mesg);
|
||||||
{
|
|
||||||
elem->next = NULL;
|
elem->next = NULL;
|
||||||
elem->throw_msg = NULL;
|
elem->throw_msg = NULL;
|
||||||
*plist = elem;
|
*plist = elem;
|
||||||
@ -268,8 +266,6 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore)
|
|||||||
(*msg_list)->throw_msg = tmsg;
|
(*msg_list)->throw_msg = tmsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -533,7 +533,9 @@ readfile (
|
|||||||
curbuf->b_p_ro = TRUE; /* must use "w!" now */
|
curbuf->b_p_ro = TRUE; /* must use "w!" now */
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (newfile) {
|
if (!newfile) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
if (perm < 0
|
if (perm < 0
|
||||||
#ifdef ENOENT
|
#ifdef ENOENT
|
||||||
&& errno == ENOENT
|
&& errno == ENOENT
|
||||||
@ -590,7 +592,6 @@ readfile (
|
|||||||
_("[Permission Denied]")), 0);
|
_("[Permission Denied]")), 0);
|
||||||
curbuf->b_p_ro = TRUE; /* must use "w!" now */
|
curbuf->b_p_ro = TRUE; /* must use "w!" now */
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -5329,7 +5330,9 @@ static void show_autocmd(AutoPat *ap, event_T event)
|
|||||||
msg_outtrans(ap->pat);
|
msg_outtrans(ap->pat);
|
||||||
|
|
||||||
for (ac = ap->cmds; ac != NULL; ac = ac->next) {
|
for (ac = ap->cmds; ac != NULL; ac = ac->next) {
|
||||||
if (ac->cmd != NULL) { /* skip removed commands */
|
if (ac->cmd == NULL) { /* skip removed commands */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (msg_col >= 14)
|
if (msg_col >= 14)
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
msg_col = 14;
|
msg_col = 14;
|
||||||
@ -5346,7 +5349,6 @@ static void show_autocmd(AutoPat *ap, event_T event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6120,7 +6122,9 @@ void ex_doautoall(exarg_T *eap)
|
|||||||
* buffers or windows...
|
* buffers or windows...
|
||||||
*/
|
*/
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
if (buf->b_ml.ml_mfp != NULL) {
|
if (buf->b_ml.ml_mfp == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/* find a window for this buffer and save some values */
|
/* find a window for this buffer and save some values */
|
||||||
aucmd_prepbuf(&aco, buf);
|
aucmd_prepbuf(&aco, buf);
|
||||||
|
|
||||||
@ -6141,7 +6145,6 @@ void ex_doautoall(exarg_T *eap)
|
|||||||
if (retval == FAIL || !buf_valid(buf))
|
if (retval == FAIL || !buf_valid(buf))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
check_cursor(); /* just in case lines got deleted */
|
check_cursor(); /* just in case lines got deleted */
|
||||||
}
|
}
|
||||||
|
@ -1639,18 +1639,17 @@ deleteFoldMarkers (
|
|||||||
*/
|
*/
|
||||||
static void foldDelMarker(linenr_T lnum, char_u *marker, int markerlen)
|
static void foldDelMarker(linenr_T lnum, char_u *marker, int markerlen)
|
||||||
{
|
{
|
||||||
char_u *line;
|
|
||||||
char_u *newline;
|
char_u *newline;
|
||||||
char_u *p;
|
|
||||||
int len;
|
|
||||||
char_u *cms = curbuf->b_p_cms;
|
char_u *cms = curbuf->b_p_cms;
|
||||||
char_u *cms2;
|
char_u *cms2;
|
||||||
|
|
||||||
line = ml_get(lnum);
|
char_u *line = ml_get(lnum);
|
||||||
for (p = line; *p != NUL; ++p)
|
for (char_u *p = line; *p != NUL; ++p) {
|
||||||
if (STRNCMP(p, marker, markerlen) == 0) {
|
if (STRNCMP(p, marker, markerlen) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/* Found the marker, include a digit if it's there. */
|
/* Found the marker, include a digit if it's there. */
|
||||||
len = markerlen;
|
int len = markerlen;
|
||||||
if (VIM_ISDIGIT(p[len]))
|
if (VIM_ISDIGIT(p[len]))
|
||||||
++len;
|
++len;
|
||||||
if (*cms != NUL) {
|
if (*cms != NUL) {
|
||||||
|
@ -680,7 +680,9 @@ static int read_redo(int init, int old_redo)
|
|||||||
p = bp->b_str;
|
p = bp->b_str;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
if ((c = *p) != NUL) {
|
if ((c = *p) == NUL) {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
/* Reverse the conversion done by add_char_buff() */
|
/* Reverse the conversion done by add_char_buff() */
|
||||||
/* For a multi-byte character get all the bytes and return the
|
/* For a multi-byte character get all the bytes and return the
|
||||||
* converted character. */
|
* converted character. */
|
||||||
@ -707,7 +709,6 @@ static int read_redo(int init, int old_redo)
|
|||||||
if (c == NUL) /* cannot happen? */
|
if (c == NUL) /* cannot happen? */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,9 @@ static void hash_may_resize(hashtab_T *ht, size_t minitems)
|
|||||||
size_t todo = ht->ht_used;
|
size_t todo = ht->ht_used;
|
||||||
|
|
||||||
for (hashitem_T *olditem = oldarray; todo > 0; ++olditem) {
|
for (hashitem_T *olditem = oldarray; todo > 0; ++olditem) {
|
||||||
if (!HASHITEM_EMPTY(olditem)) {
|
if (HASHITEM_EMPTY(olditem)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// The algorithm to find the spot to add the item is identical to
|
// The algorithm to find the spot to add the item is identical to
|
||||||
// the algorithm to find an item in hash_lookup(). But we only
|
// the algorithm to find an item in hash_lookup(). But we only
|
||||||
// need to search for a NULL key, thus it's simpler.
|
// need to search for a NULL key, thus it's simpler.
|
||||||
@ -347,7 +349,6 @@ static void hash_may_resize(hashtab_T *ht, size_t minitems)
|
|||||||
*newitem = *olditem;
|
*newitem = *olditem;
|
||||||
todo--;
|
todo--;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (ht->ht_array != ht->ht_smallarray) {
|
if (ht->ht_array != ht->ht_smallarray) {
|
||||||
free(ht->ht_array);
|
free(ht->ht_array);
|
||||||
|
@ -233,9 +233,7 @@ static int cin_islabel_skip(char_u **s)
|
|||||||
*/
|
*/
|
||||||
int cin_islabel(void)
|
int cin_islabel(void)
|
||||||
{ /* XXX */
|
{ /* XXX */
|
||||||
char_u *s;
|
char_u *s = cin_skipcomment(get_cursor_line_ptr());
|
||||||
|
|
||||||
s = cin_skipcomment(get_cursor_line_ptr());
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exclude "default" from labels, since it should be indented
|
* Exclude "default" from labels, since it should be indented
|
||||||
@ -246,7 +244,10 @@ int cin_islabel(void)
|
|||||||
if (cin_isscopedecl(s))
|
if (cin_isscopedecl(s))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (cin_islabel_skip(&s)) {
|
if (!cin_islabel_skip(&s)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only accept a label if the previous line is terminated or is a case
|
* Only accept a label if the previous line is terminated or is a case
|
||||||
* label.
|
* label.
|
||||||
@ -282,8 +283,6 @@ int cin_islabel(void)
|
|||||||
}
|
}
|
||||||
curwin->w_cursor = cursor_save;
|
curwin->w_cursor = cursor_save;
|
||||||
return TRUE; /* label at start of file??? */
|
return TRUE; /* label at start of file??? */
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3200,10 +3199,13 @@ static int find_match(int lookfor, linenr_T ourscope)
|
|||||||
curwin->w_cursor.col = 0;
|
curwin->w_cursor.col = 0;
|
||||||
|
|
||||||
look = cin_skipcomment(get_cursor_line_ptr());
|
look = cin_skipcomment(get_cursor_line_ptr());
|
||||||
if (cin_iselse(look)
|
if (!cin_iselse(look)
|
||||||
|| cin_isif(look)
|
&& !cin_isif(look)
|
||||||
|| cin_isdo(look) /* XXX */
|
&& !cin_isdo(look) /* XXX */
|
||||||
|| cin_iswhileofdo(look, curwin->w_cursor.lnum)) {
|
&& !cin_iswhileofdo(look, curwin->w_cursor.lnum)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if we've gone outside the braces entirely,
|
* if we've gone outside the braces entirely,
|
||||||
* we must be out of scope...
|
* we must be out of scope...
|
||||||
@ -3275,7 +3277,6 @@ static int find_match(int lookfor, linenr_T ourscope)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3124,7 +3124,9 @@ void check_scrollbind(linenr_T topline_diff, long leftcol_diff)
|
|||||||
for (curwin = firstwin; curwin; curwin = curwin->w_next) {
|
for (curwin = firstwin; curwin; curwin = curwin->w_next) {
|
||||||
curbuf = curwin->w_buffer;
|
curbuf = curwin->w_buffer;
|
||||||
/* skip original window and windows with 'noscrollbind' */
|
/* skip original window and windows with 'noscrollbind' */
|
||||||
if (curwin != old_curwin && curwin->w_p_scb) {
|
if (curwin == old_curwin || !curwin->w_p_scb) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* do the vertical scroll
|
* do the vertical scroll
|
||||||
*/
|
*/
|
||||||
@ -3159,7 +3161,6 @@ void check_scrollbind(linenr_T topline_diff, long leftcol_diff)
|
|||||||
leftcol_changed();
|
leftcol_changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* reset current-window
|
* reset current-window
|
||||||
|
@ -2735,7 +2735,10 @@ static int peekchr(void)
|
|||||||
{
|
{
|
||||||
static int after_slash = FALSE;
|
static int after_slash = FALSE;
|
||||||
|
|
||||||
if (curchr == -1) {
|
if (curchr != -1) {
|
||||||
|
return curchr;
|
||||||
|
}
|
||||||
|
|
||||||
switch (curchr = regparse[0]) {
|
switch (curchr = regparse[0]) {
|
||||||
case '.':
|
case '.':
|
||||||
case '[':
|
case '[':
|
||||||
@ -2879,7 +2882,6 @@ static int peekchr(void)
|
|||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
curchr = (*mb_ptr2char)(regparse);
|
curchr = (*mb_ptr2char)(regparse);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return curchr;
|
return curchr;
|
||||||
}
|
}
|
||||||
|
@ -4283,7 +4283,7 @@ static int comp_char_differs(int off_from, int off_to)
|
|||||||
*/
|
*/
|
||||||
static int char_needs_redraw(int off_from, int off_to, int cols)
|
static int char_needs_redraw(int off_from, int off_to, int cols)
|
||||||
{
|
{
|
||||||
if (cols > 0
|
return (cols > 0
|
||||||
&& ((ScreenLines[off_from] != ScreenLines[off_to]
|
&& ((ScreenLines[off_from] != ScreenLines[off_to]
|
||||||
|| ScreenAttrs[off_from] != ScreenAttrs[off_to])
|
|| ScreenAttrs[off_from] != ScreenAttrs[off_to])
|
||||||
|
|
||||||
@ -4299,10 +4299,7 @@ static int char_needs_redraw(int off_from, int off_to, int cols)
|
|||||||
&& comp_char_differs(off_from, off_to))
|
&& comp_char_differs(off_from, off_to))
|
||||||
|| ((*mb_off2cells)(off_from, off_from + cols) > 1
|
|| ((*mb_off2cells)(off_from, off_from + cols) > 1
|
||||||
&& ScreenLines[off_from + 1]
|
&& ScreenLines[off_from + 1]
|
||||||
!= ScreenLines[off_to + 1])))
|
!= ScreenLines[off_to + 1])))));
|
||||||
))
|
|
||||||
return TRUE;
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1360,8 +1360,11 @@ static int syn_stack_equal(synstate_T *sp)
|
|||||||
reg_extmatch_T *six, *bsx;
|
reg_extmatch_T *six, *bsx;
|
||||||
|
|
||||||
/* First a quick check if the stacks have the same size end nextlist. */
|
/* First a quick check if the stacks have the same size end nextlist. */
|
||||||
if (sp->sst_stacksize == current_state.ga_len
|
if (sp->sst_stacksize != current_state.ga_len
|
||||||
&& sp->sst_next_list == current_next_list) {
|
|| sp->sst_next_list != current_next_list) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Need to compare all states on both stacks. */
|
/* Need to compare all states on both stacks. */
|
||||||
if (sp->sst_stacksize > SST_FIX_STATES)
|
if (sp->sst_stacksize > SST_FIX_STATES)
|
||||||
bp = SYN_STATE_P(&(sp->sst_union.sst_ga));
|
bp = SYN_STATE_P(&(sp->sst_union.sst_ga));
|
||||||
@ -1373,7 +1376,9 @@ static int syn_stack_equal(synstate_T *sp)
|
|||||||
/* If the item has another index the state is different. */
|
/* If the item has another index the state is different. */
|
||||||
if (bp[i].bs_idx != CUR_STATE(i).si_idx)
|
if (bp[i].bs_idx != CUR_STATE(i).si_idx)
|
||||||
break;
|
break;
|
||||||
if (bp[i].bs_extmatch != CUR_STATE(i).si_extmatch) {
|
if (bp[i].bs_extmatch == CUR_STATE(i).si_extmatch) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/* When the extmatch pointers are different, the strings in
|
/* When the extmatch pointers are different, the strings in
|
||||||
* them can still be the same. Check if the extmatch
|
* them can still be the same. Check if the extmatch
|
||||||
* references are equal. */
|
* references are equal. */
|
||||||
@ -1404,10 +1409,9 @@ static int syn_stack_equal(synstate_T *sp)
|
|||||||
if (j != NSUBEXP)
|
if (j != NSUBEXP)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1509,7 +1513,6 @@ syn_finish_line (
|
|||||||
stateitem_T *cur_si;
|
stateitem_T *cur_si;
|
||||||
colnr_T prev_current_col;
|
colnr_T prev_current_col;
|
||||||
|
|
||||||
if (!current_finished) {
|
|
||||||
while (!current_finished) {
|
while (!current_finished) {
|
||||||
(void)syn_current_attr(syncing, FALSE, NULL, FALSE);
|
(void)syn_current_attr(syncing, FALSE, NULL, FALSE);
|
||||||
/*
|
/*
|
||||||
@ -1536,7 +1539,6 @@ syn_finish_line (
|
|||||||
}
|
}
|
||||||
++current_col;
|
++current_col;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3625,7 +3627,9 @@ static void put_pattern(char *s, int c, synpat_T *spp, int attr)
|
|||||||
first = TRUE;
|
first = TRUE;
|
||||||
for (i = 0; i < SPO_COUNT; ++i) {
|
for (i = 0; i < SPO_COUNT; ++i) {
|
||||||
mask = (1 << i);
|
mask = (1 << i);
|
||||||
if (spp->sp_off_flags & (mask + (mask << SPO_COUNT))) {
|
if (!(spp->sp_off_flags & (mask + (mask << SPO_COUNT)))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!first)
|
if (!first)
|
||||||
msg_putchar(','); /* separate with commas */
|
msg_putchar(','); /* separate with commas */
|
||||||
msg_puts((char_u *)spo_name_tab[i]);
|
msg_puts((char_u *)spo_name_tab[i]);
|
||||||
@ -3642,7 +3646,6 @@ static void put_pattern(char *s, int c, synpat_T *spp, int attr)
|
|||||||
msg_outnum(n);
|
msg_outnum(n);
|
||||||
first = FALSE;
|
first = FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
msg_putchar(' ');
|
msg_putchar(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3675,7 +3678,9 @@ syn_list_keywords (
|
|||||||
*/
|
*/
|
||||||
todo = (int)ht->ht_used;
|
todo = (int)ht->ht_used;
|
||||||
for (hi = ht->ht_array; todo > 0 && !got_int; ++hi) {
|
for (hi = ht->ht_array; todo > 0 && !got_int; ++hi) {
|
||||||
if (!HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
--todo;
|
--todo;
|
||||||
for (kp = HI2KE(hi); kp != NULL && !got_int; kp = kp->ke_next) {
|
for (kp = HI2KE(hi); kp != NULL && !got_int; kp = kp->ke_next) {
|
||||||
if (kp->k_syn.id == id) {
|
if (kp->k_syn.id == id) {
|
||||||
@ -3733,7 +3738,6 @@ syn_list_keywords (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return did_header;
|
return did_header;
|
||||||
}
|
}
|
||||||
@ -3749,7 +3753,9 @@ static void syn_clear_keyword(int id, hashtab_T *ht)
|
|||||||
hash_lock(ht);
|
hash_lock(ht);
|
||||||
todo = (int)ht->ht_used;
|
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)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
--todo;
|
--todo;
|
||||||
kp_prev = NULL;
|
kp_prev = NULL;
|
||||||
for (kp = HI2KE(hi); kp != NULL; ) {
|
for (kp = HI2KE(hi); kp != NULL; ) {
|
||||||
@ -3772,7 +3778,6 @@ static void syn_clear_keyword(int id, hashtab_T *ht)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
hash_unlock(ht);
|
hash_unlock(ht);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5152,8 +5157,9 @@ get_id_list (
|
|||||||
regmatch.rm_ic = TRUE;
|
regmatch.rm_ic = TRUE;
|
||||||
id = 0;
|
id = 0;
|
||||||
for (int i = highlight_ga.ga_len; --i >= 0; ) {
|
for (int i = highlight_ga.ga_len; --i >= 0; ) {
|
||||||
if (vim_regexec(®match, HL_TABLE()[i].sg_name,
|
if (!vim_regexec(®match, HL_TABLE()[i].sg_name, (colnr_T)0)) {
|
||||||
(colnr_T)0)) {
|
continue;
|
||||||
|
}
|
||||||
if (round == 2) {
|
if (round == 2) {
|
||||||
/* Got more items than expected; can happen
|
/* Got more items than expected; can happen
|
||||||
* when adding items that match:
|
* when adding items that match:
|
||||||
@ -5168,7 +5174,6 @@ get_id_list (
|
|||||||
++count;
|
++count;
|
||||||
id = -1; /* remember that we found one */
|
id = -1; /* remember that we found one */
|
||||||
}
|
}
|
||||||
}
|
|
||||||
vim_regfree(regmatch.regprog);
|
vim_regfree(regmatch.regprog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1463,7 +1463,9 @@ win_equal_rec (
|
|||||||
/* If 'winfixwidth' set keep the window width if
|
/* If 'winfixwidth' set keep the window width if
|
||||||
* possible.
|
* possible.
|
||||||
* Watch out for this window being the next_curwin. */
|
* Watch out for this window being the next_curwin. */
|
||||||
if (frame_fixed_width(fr)) {
|
if (!frame_fixed_width(fr)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
n = frame_minwidth(fr, NOWIN);
|
n = frame_minwidth(fr, NOWIN);
|
||||||
new_size = fr->fr_width;
|
new_size = fr->fr_width;
|
||||||
if (frame_has_win(fr, next_curwin)) {
|
if (frame_has_win(fr, next_curwin)) {
|
||||||
@ -1482,7 +1484,6 @@ win_equal_rec (
|
|||||||
}
|
}
|
||||||
fr->fr_newwidth = new_size;
|
fr->fr_newwidth = new_size;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (next_curwin_size == -1) {
|
if (next_curwin_size == -1) {
|
||||||
if (!has_next_curwin)
|
if (!has_next_curwin)
|
||||||
next_curwin_size = 0;
|
next_curwin_size = 0;
|
||||||
@ -1583,7 +1584,9 @@ win_equal_rec (
|
|||||||
/* If 'winfixheight' set keep the window height if
|
/* If 'winfixheight' set keep the window height if
|
||||||
* possible.
|
* possible.
|
||||||
* Watch out for this window being the next_curwin. */
|
* Watch out for this window being the next_curwin. */
|
||||||
if (frame_fixed_height(fr)) {
|
if (!frame_fixed_height(fr)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
n = frame_minheight(fr, NOWIN);
|
n = frame_minheight(fr, NOWIN);
|
||||||
new_size = fr->fr_height;
|
new_size = fr->fr_height;
|
||||||
if (frame_has_win(fr, next_curwin)) {
|
if (frame_has_win(fr, next_curwin)) {
|
||||||
@ -1602,7 +1605,6 @@ win_equal_rec (
|
|||||||
}
|
}
|
||||||
fr->fr_newheight = new_size;
|
fr->fr_newheight = new_size;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (next_curwin_size == -1) {
|
if (next_curwin_size == -1) {
|
||||||
if (!has_next_curwin)
|
if (!has_next_curwin)
|
||||||
next_curwin_size = 0;
|
next_curwin_size = 0;
|
||||||
@ -1759,7 +1761,9 @@ bool one_window(void)
|
|||||||
*/
|
*/
|
||||||
static int close_last_window_tabpage(win_T *win, int free_buf, tabpage_T *prev_curtab)
|
static int close_last_window_tabpage(win_T *win, int free_buf, tabpage_T *prev_curtab)
|
||||||
{
|
{
|
||||||
if (firstwin == lastwin) {
|
if (firstwin != lastwin) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
buf_T *old_curbuf = curbuf;
|
buf_T *old_curbuf = curbuf;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1789,8 +1793,6 @@ static int close_last_window_tabpage(win_T *win, int free_buf, tabpage_T *prev_c
|
|||||||
if (old_curbuf != curbuf)
|
if (old_curbuf != curbuf)
|
||||||
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2712,7 +2714,9 @@ close_others (
|
|||||||
/* Be very careful here: autocommands may change the window layout. */
|
/* Be very careful here: autocommands may change the window layout. */
|
||||||
for (wp = firstwin; win_valid(wp); wp = nextwp) {
|
for (wp = firstwin; win_valid(wp); wp = nextwp) {
|
||||||
nextwp = wp->w_next;
|
nextwp = wp->w_next;
|
||||||
if (wp != curwin) { /* don't close current window */
|
if (wp == curwin) { /* don't close current window */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if it's allowed to abandon this window */
|
/* Check if it's allowed to abandon this window */
|
||||||
r = can_abandon(wp->w_buffer, forceit);
|
r = can_abandon(wp->w_buffer, forceit);
|
||||||
@ -2733,7 +2737,6 @@ close_others (
|
|||||||
}
|
}
|
||||||
win_close(wp, !P_HID(wp->w_buffer) && !bufIsChanged(wp->w_buffer));
|
win_close(wp, !P_HID(wp->w_buffer) && !bufIsChanged(wp->w_buffer));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (message && lastwin != firstwin)
|
if (message && lastwin != firstwin)
|
||||||
EMSG(_("E445: Other window contains changes"));
|
EMSG(_("E445: Other window contains changes"));
|
||||||
@ -3572,7 +3575,9 @@ win_T *buf_jump_open_tab(buf_T *buf)
|
|||||||
|
|
||||||
FOR_ALL_TABS(tp) {
|
FOR_ALL_TABS(tp) {
|
||||||
// Skip the current tab since we already checked it.
|
// Skip the current tab since we already checked it.
|
||||||
if (tp != curtab) {
|
if (tp == curtab) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
FOR_ALL_WINDOWS_IN_TAB(wp, tp) {
|
FOR_ALL_WINDOWS_IN_TAB(wp, tp) {
|
||||||
if (wp->w_buffer == buf) {
|
if (wp->w_buffer == buf) {
|
||||||
goto_tabpage_win(tp, wp);
|
goto_tabpage_win(tp, wp);
|
||||||
@ -3588,7 +3593,6 @@ win_T *buf_jump_open_tab(buf_T *buf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// If we made it this far, we didn't find the buffer.
|
// If we made it this far, we didn't find the buffer.
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user