summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-12-30 18:07:46 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-30 18:07:46 +0000
commited0c1d5d4b30d03b26ff08841f6da2ddf44025a7 (patch)
treef30f357f2f6b1e3152cc52d038f41b7adced9840 /src/ex_cmds.c
parentef91ae4557ac93e581b0ec39bf4c78c3556d7484 (diff)
patch 9.0.1115: code is indented more than neededv9.0.1115
Problem: Code is indented more than needed. Solution: Use an early return to reduce indenting. (Yegappan Lakshmanan, closes #11758)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c152
1 files changed, 76 insertions, 76 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 693b0acace..faff4aadaf 100644
--- a/src/ex_cmds.c
+++ b/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;
}
- 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)
+ // ":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)
{
- if (wp->w_buffer == buf)
+ goto_tabpage_win(tp, wp);
+ curwin->w_arg_idx = 0;
+ if (!bufIsChanged(curbuf))
{
- goto_tabpage_win(tp, wp);
- curwin->w_arg_idx = 0;
- if (!bufIsChanged(curbuf))
- {
- int save_ar = curbuf->b_p_ar;
+ 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;
+ // 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;
- }
+ /*
+ * 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);
+ // 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);
}
/*
@@ -5556,53 +5555,54 @@ ex_oldfiles(exarg_T *eap UNUSED)
char_u *fname;
if (l == NULL)
+ {
msg(_("No old files"));
- else
+ return;
+ }
+
+ msg_start();
+ msg_scroll = TRUE;
+ for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
{
- 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))
{
- ++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_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;
+ // 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