summaryrefslogtreecommitdiffstats
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
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)
-rw-r--r--src/ex_cmds.c152
-rw-r--r--src/ex_cmds2.c115
-rw-r--r--src/ex_docmd.c358
-rw-r--r--src/ex_getln.c62
-rw-r--r--src/version.c2
5 files changed, 355 insertions, 334 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
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 3bdbede138..c52c227de9 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -135,19 +135,19 @@ check_changed(buf_T *buf, int flags)
void
browse_save_fname(buf_T *buf)
{
- if (buf->b_fname == NULL)
- {
- char_u *fname;
+ if (buf->b_fname != NULL)
+ return;
- fname = do_browse(BROWSE_SAVE, (char_u *)_("Save As"),
- NULL, NULL, NULL, NULL, buf);
- if (fname != NULL)
- {
- if (setfname(buf, fname, NULL, TRUE) == OK)
- buf->b_flags |= BF_NOTEDITED;
- vim_free(fname);
- }
- }
+ char_u *fname;
+
+ fname = do_browse(BROWSE_SAVE, (char_u *)_("Save As"),
+ NULL, NULL, NULL, NULL, buf);
+ if (fname == NULL)
+ return;
+
+ if (setfname(buf, fname, NULL, TRUE) == OK)
+ buf->b_flags |= BF_NOTEDITED;
+ vim_free(fname);
}
#endif
@@ -731,60 +731,59 @@ ex_compiler(exarg_T *eap)
// List all compiler scripts.
do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')");
// ) keep the indenter happy...
+ return;
+ }
+
+ buf = alloc(STRLEN(eap->arg) + 14);
+ if (buf == NULL)
+ return;
+
+ if (eap->forceit)
+ {
+ // ":compiler! {name}" sets global options
+ do_cmdline_cmd((char_u *)
+ "command -nargs=* CompilerSet set <args>");
}
else
{
- buf = alloc(STRLEN(eap->arg) + 14);
- if (buf != NULL)
- {
- if (eap->forceit)
- {
- // ":compiler! {name}" sets global options
- do_cmdline_cmd((char_u *)
- "command -nargs=* CompilerSet set <args>");
- }
- else
- {
- // ":compiler! {name}" sets local options.
- // To remain backwards compatible "current_compiler" is always
- // used. A user's compiler plugin may set it, the distributed
- // plugin will then skip the settings. Afterwards set
- // "b:current_compiler" and restore "current_compiler".
- // Explicitly prepend "g:" to make it work in a function.
- old_cur_comp = get_var_value((char_u *)"g:current_compiler");
- if (old_cur_comp != NULL)
- old_cur_comp = vim_strsave(old_cur_comp);
- do_cmdline_cmd((char_u *)
- "command -nargs=* -keepscript CompilerSet setlocal <args>");
- }
- do_unlet((char_u *)"g:current_compiler", TRUE);
- do_unlet((char_u *)"b:current_compiler", TRUE);
+ // ":compiler! {name}" sets local options.
+ // To remain backwards compatible "current_compiler" is always
+ // used. A user's compiler plugin may set it, the distributed
+ // plugin will then skip the settings. Afterwards set
+ // "b:current_compiler" and restore "current_compiler".
+ // Explicitly prepend "g:" to make it work in a function.
+ old_cur_comp = get_var_value((char_u *)"g:current_compiler");
+ if (old_cur_comp != NULL)
+ old_cur_comp = vim_strsave(old_cur_comp);
+ do_cmdline_cmd((char_u *)
+ "command -nargs=* -keepscript CompilerSet setlocal <args>");
+ }
+ do_unlet((char_u *)"g:current_compiler", TRUE);
+ do_unlet((char_u *)"b:current_compiler", TRUE);
- sprintf((char *)buf, "compiler/%s.vim", eap->arg);
- if (source_runtime(buf, DIP_ALL) == FAIL)
- semsg(_(e_compiler_not_supported_str), eap->arg);
- vim_free(buf);
+ sprintf((char *)buf, "compiler/%s.vim", eap->arg);
+ if (source_runtime(buf, DIP_ALL) == FAIL)
+ semsg(_(e_compiler_not_supported_str), eap->arg);
+ vim_free(buf);
- do_cmdline_cmd((char_u *)":delcommand CompilerSet");
+ do_cmdline_cmd((char_u *)":delcommand CompilerSet");
- // Set "b:current_compiler" from "current_compiler".
- p = get_var_value((char_u *)"g:current_compiler");
- if (p != NULL)
- set_internal_string_var((char_u *)"b:current_compiler", p);
+ // Set "b:current_compiler" from "current_compiler".
+ p = get_var_value((char_u *)"g:current_compiler");
+ if (p != NULL)
+ set_internal_string_var((char_u *)"b:current_compiler", p);
- // Restore "current_compiler" for ":compiler {name}".
- if (!eap->forceit)
- {
- if (old_cur_comp != NULL)
- {
- set_internal_string_var((char_u *)"g:current_compiler",
- old_cur_comp);
- vim_free(old_cur_comp);
- }
- else
- do_unlet((char_u *)"g:current_compiler", TRUE);
- }
+ // Restore "current_compiler" for ":compiler {name}".
+ if (!eap->forceit)
+ {
+ if (old_cur_comp != NULL)
+ {
+ set_internal_string_var((char_u *)"g:current_compiler",
+ old_cur_comp);
+ vim_free(old_cur_comp);
}
+ else
+ do_unlet((char_u *)"g:current_compiler", TRUE);
}
}
#endif
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 660d32e2a4..9a507c90fa 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1739,7 +1739,6 @@ do_one_cmd(
char_u *cmd;
int starts_with_colon = FALSE;
int may_have_range;
- int vim9script;
#ifdef FEAT_EVAL
int did_set_expr_line = FALSE;
#endif
@@ -1807,7 +1806,7 @@ do_one_cmd(
// In Vim9 script a colon is required before the range. This may also be
// after command modifiers.
- vim9script = in_vim9script();
+ int vim9script = in_vim9script();
if (vim9script && (flags & DOCMD_RANGEOK) == 0)
{
may_have_range = FALSE;
@@ -6230,29 +6229,37 @@ ex_tabclose(exarg_T *eap)
int tab_number;
if (cmdwin_type != 0)
+ {
cmdwin_result = K_IGNORE;
- else if (first_tabpage->tp_next == NULL)
+ return;
+ }
+
+ if (first_tabpage->tp_next == NULL)
+ {
emsg(_(e_cannot_close_last_tab_page));
- else if (!window_layout_locked(CMD_tabclose))
+ return;
+ }
+
+ if (window_layout_locked(CMD_tabclose))
+ return;
+
+ tab_number = get_tabpage_arg(eap);
+ if (eap->errmsg != NULL)
+ return;
+
+ tp = find_tabpage(tab_number);
+ if (tp == NULL)
{
- tab_number = get_tabpage_arg(eap);
- if (eap->errmsg == NULL)
- {
- tp = find_tabpage(tab_number);
- if (tp == NULL)
- {
- beep_flush();
- return;
- }
- if (tp != curtab)
- {
- tabpage_close_other(tp, eap->forceit);
- return;
- }
- else if (!text_locked() && !curbuf_locked())
- tabpage_close(eap->forceit);
- }
+ beep_flush();
+ return;
}
+ if (tp != curtab)
+ {
+ tabpage_close_other(tp, eap->forceit);
+ return;
+ }
+ else if (!text_locked() && !curbuf_locked())
+ tabpage_close(eap->forceit);
}
/*
@@ -6266,33 +6273,41 @@ ex_tabonly(exarg_T *eap)
int tab_number;
if (cmdwin_type != 0)
+ {
cmdwin_result = K_IGNORE;
- else if (first_tabpage->tp_next == NULL)
+ return;
+ }
+
+ if (first_tabpage->tp_next == NULL)
+ {
msg(_("Already only one tab page"));
- else if (!window_layout_locked(CMD_tabonly))
+ return;
+ }
+
+ if (window_layout_locked(CMD_tabonly))
+ return;
+
+ tab_number = get_tabpage_arg(eap);
+ if (eap->errmsg != NULL)
+ return;
+
+ goto_tabpage(tab_number);
+ // Repeat this up to a 1000 times, because autocommands may
+ // mess up the lists.
+ for (done = 0; done < 1000; ++done)
{
- tab_number = get_tabpage_arg(eap);
- if (eap->errmsg == NULL)
- {
- goto_tabpage(tab_number);
- // Repeat this up to a 1000 times, because autocommands may
- // mess up the lists.
- for (done = 0; done < 1000; ++done)
+ FOR_ALL_TABPAGES(tp)
+ if (tp->tp_topframe != topframe)
{
- FOR_ALL_TABPAGES(tp)
- if (tp->tp_topframe != topframe)
- {
- tabpage_close_other(tp, eap->forceit);
- // if we failed to close it quit
- if (valid_tabpage(tp))
- done = 1000;
- // start over, "tp" is now invalid
- break;
- }
- if (first_tabpage->tp_next == NULL)
- break;
+ tabpage_close_other(tp, eap->forceit);
+ // if we failed to close it quit
+ if (valid_tabpage(tp))
+ done = 1000;
+ // start over, "tp" is now invalid
+ break;
}
- }
+ if (first_tabpage->tp_next == NULL)
+ break;
}
}
@@ -6375,30 +6390,30 @@ ex_only(exarg_T *eap)
ex_hide(exarg_T *eap UNUSED)
{
// ":hide" or ":hide | cmd": hide current window
- if (!eap->skip)
- {
- if (window_layout_locked(CMD_hide))
- return;
+ if (eap->skip)
+ return;
+
+ if (window_layout_locked(CMD_hide))
+ return;
#ifdef FEAT_GUI
- need_mouse_correct = TRUE;
+ need_mouse_correct = TRUE;
#endif
- if (eap->addr_count == 0)
- win_close(curwin, FALSE); // don't free buffer
- else
- {
- int winnr = 0;
- win_T *win;
+ if (eap->addr_count == 0)
+ win_close(curwin, FALSE); // don't free buffer
+ else
+ {
+ int winnr = 0;
+ win_T *win;
- FOR_ALL_WINDOWS(win)
- {
- winnr++;
- if (winnr == eap->line2)
- break;
- }
- if (win == NULL)
- win = lastwin;
- win_close(win, FALSE);
+ FOR_ALL_WINDOWS(win)
+ {
+ winnr++;
+ if (winnr == eap->line2)
+ break;
}
+ if (win == NULL)
+ win = lastwin;
+ win_close(win, FALSE);
}
}
@@ -6411,26 +6426,26 @@ ex_stop(exarg_T *eap)
/*
* Disallow suspending for "rvim".
*/
- if (!check_restricted())
- {
- if (!eap->forceit)
- autowrite_all();
- apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, FALSE, NULL);
- windgoto((int)Rows - 1, 0);
- out_char('\n');
- out_flush();
- stoptermcap();
- out_flush(); // needed for SUN to restore xterm buffer
- mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles
- ui_suspend(); // call machine specific function
- maketitle();
- resettitle(); // force updating the title
- starttermcap();
- scroll_start(); // scroll screen before redrawing
- redraw_later_clear();
- shell_resized(); // may have resized window
- apply_autocmds(EVENT_VIMRESUME, NULL, NULL, FALSE, NULL);
- }
+ if (check_restricted())
+ return;
+
+ if (!eap->forceit)
+ autowrite_all();
+ apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, FALSE, NULL);
+ windgoto((int)Rows - 1, 0);
+ out_char('\n');
+ out_flush();
+ stoptermcap();
+ out_flush(); // needed for SUN to restore xterm buffer
+ mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles
+ ui_suspend(); // call machine specific function
+ maketitle();
+ resettitle(); // force updating the title
+ starttermcap();
+ scroll_start(); // scroll screen before redrawing
+ redraw_later_clear();
+ shell_resized(); // may have resized window
+ apply_autocmds(EVENT_VIMRESUME, NULL, NULL, FALSE, NULL);
}
/*
@@ -7403,73 +7418,74 @@ ex_read(exarg_T *eap)
linenr_T lnum;
if (eap->usefilter) // :r!cmd
- do_bang(1, eap, FALSE, FALSE, TRUE);
- else
{
- if (u_save(eap->line2, (linenr_T)(eap->line2 + 1)) == FAIL)
- return;
+ do_bang(1, eap, FALSE, FALSE, TRUE);
+ return;
+ }
+
+ if (u_save(eap->line2, (linenr_T)(eap->line2 + 1)) == FAIL)
+ return;
#ifdef FEAT_BROWSE
- if (cmdmod.cmod_flags & CMOD_BROWSE)
- {
- char_u *browseFile;
+ if (cmdmod.cmod_flags & CMOD_BROWSE)
+ {
+ char_u *browseFile;
- browseFile = do_browse(0, (char_u *)_("Append File"), eap->arg,
- NULL, NULL, NULL, curbuf);
- if (browseFile != NULL)
- {
- i = readfile(browseFile, NULL,
- eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0);
- vim_free(browseFile);
- }
- else
- i = OK;
+ browseFile = do_browse(0, (char_u *)_("Append File"), eap->arg,
+ NULL, NULL, NULL, curbuf);
+ if (browseFile != NULL)
+ {
+ i = readfile(browseFile, NULL,
+ eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0);
+ vim_free(browseFile);
}
else
+ i = OK;
+ }
+ else
#endif
- if (*eap->arg == NUL)
+ if (*eap->arg == NUL)
{
if (check_fname() == FAIL) // check for no file name
return;
i = readfile(curbuf->b_ffname, curbuf->b_fname,
- eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0);
+ eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0);
}
else
{
if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL)
(void)setaltfname(eap->arg, eap->arg, (linenr_T)1);
i = readfile(eap->arg, NULL,
- eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0);
+ eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0);
}
- if (i != OK)
- {
+ if (i != OK)
+ {
#if defined(FEAT_EVAL)
- if (!aborting())
+ if (!aborting())
#endif
- semsg(_(e_cant_open_file_str), eap->arg);
- }
- else
+ semsg(_(e_cant_open_file_str), eap->arg);
+ }
+ else
+ {
+ if (empty && exmode_active)
{
- if (empty && exmode_active)
+ // Delete the empty line that remains. Historically ex does
+ // this but vi doesn't.
+ if (eap->line2 == 0)
+ lnum = curbuf->b_ml.ml_line_count;
+ else
+ lnum = 1;
+ if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK)
{
- // Delete the empty line that remains. Historically ex does
- // this but vi doesn't.
- if (eap->line2 == 0)
- lnum = curbuf->b_ml.ml_line_count;
- else
- lnum = 1;
- if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK)
- {
- ml_delete(lnum);
- if (curwin->w_cursor.lnum > 1
- && curwin->w_cursor.lnum >= lnum)
- --curwin->w_cursor.lnum;
- deleted_lines_mark(lnum, 1L);
- }
+ ml_delete(lnum);
+ if (curwin->w_cursor.lnum > 1
+ && curwin->w_cursor.lnum >= lnum)
+ --curwin->w_cursor.lnum;
+ deleted_lines_mark(lnum, 1L);
}
- redraw_curbuf_later(UPD_VALID);
}
+ redraw_curbuf_later(UPD_VALID);
}
}
@@ -7675,23 +7691,24 @@ ex_cd(exarg_T *eap)
#if !defined(UNIX) && !defined(VMS)
// for non-UNIX ":cd" means: print current directory unless 'cdhome' is set
if (*new_dir == NUL && !p_cdh)
+ {
ex_pwd(NULL);
- else
+ return;
+ }
#endif
- {
- cdscope_T scope = CDSCOPE_GLOBAL;
- if (eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir)
- scope = CDSCOPE_WINDOW;
- else if (eap->cmdidx == CMD_tcd || eap->cmdidx == CMD_tchdir)
- scope = CDSCOPE_TABPAGE;
+ cdscope_T scope = CDSCOPE_GLOBAL;
- if (changedir_func(new_dir, eap->forceit, scope))
- {
- // Echo the new current directory if the command was typed.
- if (KeyTyped || p_verbose >= 5)
- ex_pwd(eap);
- }
+ if (eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir)
+ scope = CDSCOPE_WINDOW;
+ else if (eap->cmdidx == CMD_tcd || eap->cmdidx == CMD_tchdir)
+ scope = CDSCOPE_TABPAGE;
+
+ if (changedir_func(new_dir, eap->forceit, scope))
+ {
+ // Echo the new current directory if the command was typed.
+ if (KeyTyped || p_verbose >= 5)
+ ex_pwd(eap);
}
}
@@ -8155,23 +8172,22 @@ ex_at(exarg_T *eap)
== FAIL)
{
beep_flush();
+ return;
}
- else
- {
- int save_efr = exec_from_reg;
- exec_from_reg = TRUE;
+ int save_efr = exec_from_reg;
- /*
- * Execute from the typeahead buffer.
- * Continue until the stuff buffer is empty and all added characters
- * have been consumed.
- */
- while (!stuff_empty() || typebuf.tb_len > prev_len)
- (void)do_cmdline(NULL, getexline, NULL, DOCMD_NOWAIT|DOCMD_VERBOSE);
+ exec_from_reg = TRUE;
- exec_from_reg = save_efr;
- }
+ /*
+ * Execute from the typeahead buffer.
+ * Continue until the stuff buffer is empty and all added characters
+ * have been consumed.
+ */
+ while (!stuff_empty() || typebuf.tb_len > prev_len)
+ (void)do_cmdline(NULL, getexline, NULL, DOCMD_NOWAIT|DOCMD_VERBOSE);
+
+ exec_from_reg = save_efr;
}
/*
@@ -8560,18 +8576,23 @@ ex_mark(exarg_T *eap)
return;
#endif
if (*eap->arg == NUL) // No argument?
+ {
emsg(_(e_argument_required));
- else if (eap->arg[1] != NUL) // more than one character?
- semsg(_(e_trailing_characters_str), eap->arg);
- else
+ return;
+ }
+
+ if (eap->arg[1] != NUL) // more than one character?
{
- pos = curwin->w_cursor; // save curwin->w_cursor
- curwin->w_cursor.lnum = eap->line2;
- beginline(BL_WHITE | BL_FIX);
- if (setmark(*eap->arg) == FAIL) // set mark
- emsg(_(e_argument_must_be_letter_or_forward_backward_quote));
- curwin->w_cursor = pos; // restore curwin->w_cursor
+ semsg(_(e_trailing_characters_str), eap->arg);
+ return;
}
+
+ pos = curwin->w_cursor; // save curwin->w_cursor
+ curwin->w_cursor.lnum = eap->line2;
+ beginline(BL_WHITE | BL_FIX);
+ if (setmark(*eap->arg) == FAIL) // set mark
+ emsg(_(e_argument_must_be_letter_or_forward_backward_quote));
+ curwin->w_cursor = pos; // restore curwin->w_cursor
}
/*
@@ -9685,17 +9706,16 @@ ex_filetype(exarg_T *eap)
static void
ex_setfiletype(exarg_T *eap)
{
- if (!did_filetype)
- {
- char_u *arg = eap->arg;
+ if (did_filetype)
+ return;
- if (STRNCMP(arg, "FALLBACK ", 9) == 0)
- arg += 9;
+ char_u *arg = eap->arg;
+ if (STRNCMP(arg, "FALLBACK ", 9) == 0)
+ arg += 9;
- set_option_value_give_err((char_u *)"filetype", 0L, arg, OPT_LOCAL);
- if (arg != eap->arg)
- did_filetype = FALSE;
- }
+ set_option_value_give_err((char_u *)"filetype", 0L, arg, OPT_LOCAL);
+ if (arg != eap->arg)
+ did_filetype = FALSE;
}
static void
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 5614ea6a9e..4884ebd8a3 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -368,36 +368,36 @@ finish_incsearch_highlighting(
incsearch_state_T *is_state,
int call_update_screen)
{
- if (is_state->did_incsearch)
+ if (!is_state->did_incsearch)
+ return;
+
+ is_state->did_incsearch = FALSE;
+ if (gotesc)
+ curwin->w_cursor = is_state->save_cursor;
+ else
{
- is_state->did_incsearch = FALSE;
- if (gotesc)
- curwin->w_cursor = is_state->save_cursor;
- else
+ if (!EQUAL_POS(is_state->save_cursor, is_state->search_start))
{
- if (!EQUAL_POS(is_state->save_cursor, is_state->search_start))
- {
- // put the '" mark at the original position
- curwin->w_cursor = is_state->save_cursor;
- setpcmark();
- }
- curwin->w_cursor = is_state->search_start;
+ // put the '" mark at the original position
+ curwin->w_cursor = is_state->save_cursor;
+ setpcmark();
}
- restore_viewstate(&is_state->old_viewstate);
- highlight_match = FALSE;
+ curwin->w_cursor = is_state->search_start;
+ }
+ restore_viewstate(&is_state->old_viewstate);
+ highlight_match = FALSE;
- // by default search all lines
- search_first_line = 0;
- search_last_line = MAXLNUM;
+ // by default search all lines
+ search_first_line = 0;
+ search_last_line = MAXLNUM;
- magic_overruled = is_state->magic_overruled_save;
+ magic_overruled = is_state->magic_overruled_save;
- validate_cursor(); // needed for TAB
- status_redraw_all();
- redraw_all_later(UPD_SOME_VALID);
- if (call_update_screen)
- update_screen(UPD_SOME_VALID);
- }
+ validate_cursor(); // needed for TAB
+ status_redraw_all();
+ redraw_all_later(UPD_SOME_VALID);
+ if (call_update_screen)
+ update_screen(UPD_SOME_VALID);
}
/*
@@ -4032,13 +4032,13 @@ escape_fname(char_u **pp)
char_u *p;
p = alloc(STRLEN(*pp) + 2);
- if (p != NULL)
- {
- p[0] = '\\';
- STRCPY(p + 1, *pp);
- vim_free(*pp);
- *pp = p;
- }
+ if (p == NULL)
+ return;
+
+ p[0] = '\\';
+ STRCPY(p + 1, *pp);
+ vim_free(*pp);
+ *pp = p;
}
/*
diff --git a/src/version.c b/src/version.c
index 2571f5198e..3166491beb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1115,
+/**/
1114,
/**/
1113,