mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.1115: code is indented more than needed
Problem: Code is indented more than needed. Solution: Use an early return to reduce indenting. (Yegappan Lakshmanan, closes #11758)
This commit is contained in:
committed by
Bram Moolenaar
parent
ef91ae4557
commit
ed0c1d5d4b
174
src/ex_cmds.c
174
src/ex_cmds.c
@@ -5413,56 +5413,55 @@ ex_drop(exarg_T *eap)
|
||||
// edited in a window yet. It's like ":tab all" but without closing
|
||||
// windows or tabs.
|
||||
ex_all(eap);
|
||||
return;
|
||||
}
|
||||
|
||||
// ":drop file ...": Edit the first argument. Jump to an existing
|
||||
// window if possible, edit in current window if the current buffer
|
||||
// can be abandoned, otherwise open a new window.
|
||||
buf = buflist_findnr(ARGLIST[0].ae_fnum);
|
||||
|
||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||
{
|
||||
if (wp->w_buffer == buf)
|
||||
{
|
||||
goto_tabpage_win(tp, wp);
|
||||
curwin->w_arg_idx = 0;
|
||||
if (!bufIsChanged(curbuf))
|
||||
{
|
||||
int save_ar = curbuf->b_p_ar;
|
||||
|
||||
// reload the file if it is newer
|
||||
curbuf->b_p_ar = TRUE;
|
||||
buf_check_timestamp(curbuf, FALSE);
|
||||
curbuf->b_p_ar = save_ar;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether the current buffer is changed. If so, we will need
|
||||
* to split the current window or data could be lost.
|
||||
* Skip the check if the 'hidden' option is set, as in this case the
|
||||
* buffer won't be lost.
|
||||
*/
|
||||
if (!buf_hide(curbuf))
|
||||
{
|
||||
++emsg_off;
|
||||
split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD);
|
||||
--emsg_off;
|
||||
}
|
||||
|
||||
// Fake a ":sfirst" or ":first" command edit the first argument.
|
||||
if (split)
|
||||
{
|
||||
eap->cmdidx = CMD_sfirst;
|
||||
eap->cmd[0] = 's';
|
||||
}
|
||||
else
|
||||
{
|
||||
// ":drop file ...": Edit the first argument. Jump to an existing
|
||||
// window if possible, edit in current window if the current buffer
|
||||
// can be abandoned, otherwise open a new window.
|
||||
buf = buflist_findnr(ARGLIST[0].ae_fnum);
|
||||
|
||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||
{
|
||||
if (wp->w_buffer == buf)
|
||||
{
|
||||
goto_tabpage_win(tp, wp);
|
||||
curwin->w_arg_idx = 0;
|
||||
if (!bufIsChanged(curbuf))
|
||||
{
|
||||
int save_ar = curbuf->b_p_ar;
|
||||
|
||||
// reload the file if it is newer
|
||||
curbuf->b_p_ar = TRUE;
|
||||
buf_check_timestamp(curbuf, FALSE);
|
||||
curbuf->b_p_ar = save_ar;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether the current buffer is changed. If so, we will need
|
||||
* to split the current window or data could be lost.
|
||||
* Skip the check if the 'hidden' option is set, as in this case the
|
||||
* buffer won't be lost.
|
||||
*/
|
||||
if (!buf_hide(curbuf))
|
||||
{
|
||||
++emsg_off;
|
||||
split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD);
|
||||
--emsg_off;
|
||||
}
|
||||
|
||||
// Fake a ":sfirst" or ":first" command edit the first argument.
|
||||
if (split)
|
||||
{
|
||||
eap->cmdidx = CMD_sfirst;
|
||||
eap->cmd[0] = 's';
|
||||
}
|
||||
else
|
||||
eap->cmdidx = CMD_first;
|
||||
ex_rewind(eap);
|
||||
}
|
||||
eap->cmdidx = CMD_first;
|
||||
ex_rewind(eap);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -5556,53 +5555,54 @@ ex_oldfiles(exarg_T *eap UNUSED)
|
||||
char_u *fname;
|
||||
|
||||
if (l == NULL)
|
||||
msg(_("No old files"));
|
||||
else
|
||||
{
|
||||
msg_start();
|
||||
msg_scroll = TRUE;
|
||||
for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
|
||||
{
|
||||
++nr;
|
||||
fname = tv_get_string(&li->li_tv);
|
||||
if (!message_filtered(fname))
|
||||
{
|
||||
msg_outnum((long)nr);
|
||||
msg_puts(": ");
|
||||
msg_outtrans(fname);
|
||||
msg_clr_eos();
|
||||
msg_putchar('\n');
|
||||
out_flush(); // output one line at a time
|
||||
ui_breakcheck();
|
||||
}
|
||||
}
|
||||
msg(_("No old files"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Assume "got_int" was set to truncate the listing.
|
||||
got_int = FALSE;
|
||||
msg_start();
|
||||
msg_scroll = TRUE;
|
||||
for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
|
||||
{
|
||||
++nr;
|
||||
fname = tv_get_string(&li->li_tv);
|
||||
if (!message_filtered(fname))
|
||||
{
|
||||
msg_outnum((long)nr);
|
||||
msg_puts(": ");
|
||||
msg_outtrans(fname);
|
||||
msg_clr_eos();
|
||||
msg_putchar('\n');
|
||||
out_flush(); // output one line at a time
|
||||
ui_breakcheck();
|
||||
}
|
||||
}
|
||||
|
||||
// Assume "got_int" was set to truncate the listing.
|
||||
got_int = FALSE;
|
||||
|
||||
# ifdef FEAT_BROWSE_CMD
|
||||
if (cmdmod.cmod_flags & CMOD_BROWSE)
|
||||
if (cmdmod.cmod_flags & CMOD_BROWSE)
|
||||
{
|
||||
quit_more = FALSE;
|
||||
nr = prompt_for_number(FALSE);
|
||||
msg_starthere();
|
||||
if (nr > 0)
|
||||
{
|
||||
quit_more = FALSE;
|
||||
nr = prompt_for_number(FALSE);
|
||||
msg_starthere();
|
||||
if (nr > 0)
|
||||
{
|
||||
char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
|
||||
(long)nr);
|
||||
char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
|
||||
(long)nr);
|
||||
|
||||
if (p != NULL)
|
||||
{
|
||||
p = expand_env_save(p);
|
||||
eap->arg = p;
|
||||
eap->cmdidx = CMD_edit;
|
||||
cmdmod.cmod_flags &= ~CMOD_BROWSE;
|
||||
do_exedit(eap, NULL);
|
||||
vim_free(p);
|
||||
}
|
||||
if (p != NULL)
|
||||
{
|
||||
p = expand_env_save(p);
|
||||
eap->arg = p;
|
||||
eap->cmdidx = CMD_edit;
|
||||
cmdmod.cmod_flags &= ~CMOD_BROWSE;
|
||||
do_exedit(eap, NULL);
|
||||
vim_free(p);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user