0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -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:
Yegappan Lakshmanan
2022-12-30 18:07:46 +00:00
committed by Bram Moolenaar
parent ef91ae4557
commit ed0c1d5d4b
5 changed files with 379 additions and 358 deletions

View File

@@ -5413,56 +5413,55 @@ ex_drop(exarg_T *eap)
// edited in a window yet. It's like ":tab all" but without closing // edited in a window yet. It's like ":tab all" but without closing
// windows or tabs. // windows or tabs.
ex_all(eap); 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 else
{ eap->cmdidx = CMD_first;
// ":drop file ...": Edit the first argument. Jump to an existing ex_rewind(eap);
// 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);
}
} }
/* /*
@@ -5556,53 +5555,54 @@ ex_oldfiles(exarg_T *eap UNUSED)
char_u *fname; char_u *fname;
if (l == NULL) if (l == NULL)
msg(_("No old files"));
else
{ {
msg_start(); msg(_("No old files"));
msg_scroll = TRUE; return;
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. msg_start();
got_int = FALSE; 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 # 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; char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
nr = prompt_for_number(FALSE); (long)nr);
msg_starthere();
if (nr > 0)
{
char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
(long)nr);
if (p != NULL) if (p != NULL)
{ {
p = expand_env_save(p); p = expand_env_save(p);
eap->arg = p; eap->arg = p;
eap->cmdidx = CMD_edit; eap->cmdidx = CMD_edit;
cmdmod.cmod_flags &= ~CMOD_BROWSE; cmdmod.cmod_flags &= ~CMOD_BROWSE;
do_exedit(eap, NULL); do_exedit(eap, NULL);
vim_free(p); vim_free(p);
}
} }
} }
# endif
} }
# endif
} }
#endif #endif

View File

@@ -135,19 +135,19 @@ check_changed(buf_T *buf, int flags)
void void
browse_save_fname(buf_T *buf) browse_save_fname(buf_T *buf)
{ {
if (buf->b_fname == NULL) if (buf->b_fname != NULL)
{ return;
char_u *fname;
fname = do_browse(BROWSE_SAVE, (char_u *)_("Save As"), char_u *fname;
NULL, NULL, NULL, NULL, buf);
if (fname != NULL) fname = do_browse(BROWSE_SAVE, (char_u *)_("Save As"),
{ NULL, NULL, NULL, NULL, buf);
if (setfname(buf, fname, NULL, TRUE) == OK) if (fname == NULL)
buf->b_flags |= BF_NOTEDITED; return;
vim_free(fname);
} if (setfname(buf, fname, NULL, TRUE) == OK)
} buf->b_flags |= BF_NOTEDITED;
vim_free(fname);
} }
#endif #endif
@@ -731,60 +731,59 @@ ex_compiler(exarg_T *eap)
// List all compiler scripts. // List all compiler scripts.
do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')"); do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')");
// ) keep the indenter happy... // ) 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 else
{ {
buf = alloc(STRLEN(eap->arg) + 14); // ":compiler! {name}" sets local options.
if (buf != NULL) // 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);
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);
// Restore "current_compiler" for ":compiler {name}".
if (!eap->forceit)
{
if (old_cur_comp != NULL)
{ {
if (eap->forceit) set_internal_string_var((char_u *)"g:current_compiler",
{ old_cur_comp);
// ":compiler! {name}" sets global options vim_free(old_cur_comp);
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);
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");
// 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);
}
} }
else
do_unlet((char_u *)"g:current_compiler", TRUE);
} }
} }
#endif #endif

View File

@@ -1739,7 +1739,6 @@ do_one_cmd(
char_u *cmd; char_u *cmd;
int starts_with_colon = FALSE; int starts_with_colon = FALSE;
int may_have_range; int may_have_range;
int vim9script;
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
int did_set_expr_line = FALSE; int did_set_expr_line = FALSE;
#endif #endif
@@ -1807,7 +1806,7 @@ do_one_cmd(
// In Vim9 script a colon is required before the range. This may also be // In Vim9 script a colon is required before the range. This may also be
// after command modifiers. // after command modifiers.
vim9script = in_vim9script(); int vim9script = in_vim9script();
if (vim9script && (flags & DOCMD_RANGEOK) == 0) if (vim9script && (flags & DOCMD_RANGEOK) == 0)
{ {
may_have_range = FALSE; may_have_range = FALSE;
@@ -6230,29 +6229,37 @@ ex_tabclose(exarg_T *eap)
int tab_number; int tab_number;
if (cmdwin_type != 0) if (cmdwin_type != 0)
cmdwin_result = K_IGNORE;
else if (first_tabpage->tp_next == NULL)
emsg(_(e_cannot_close_last_tab_page));
else if (!window_layout_locked(CMD_tabclose))
{ {
tab_number = get_tabpage_arg(eap); cmdwin_result = K_IGNORE;
if (eap->errmsg == NULL) return;
{
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);
}
} }
if (first_tabpage->tp_next == NULL)
{
emsg(_(e_cannot_close_last_tab_page));
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)
{
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; int tab_number;
if (cmdwin_type != 0) if (cmdwin_type != 0)
cmdwin_result = K_IGNORE;
else if (first_tabpage->tp_next == NULL)
msg(_("Already only one tab page"));
else if (!window_layout_locked(CMD_tabonly))
{ {
tab_number = get_tabpage_arg(eap); cmdwin_result = K_IGNORE;
if (eap->errmsg == NULL) return;
{ }
goto_tabpage(tab_number);
// Repeat this up to a 1000 times, because autocommands may if (first_tabpage->tp_next == NULL)
// mess up the lists. {
for (done = 0; done < 1000; ++done) msg(_("Already only one tab page"));
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)
{
FOR_ALL_TABPAGES(tp)
if (tp->tp_topframe != topframe)
{ {
FOR_ALL_TABPAGES(tp) tabpage_close_other(tp, eap->forceit);
if (tp->tp_topframe != topframe) // if we failed to close it quit
{ if (valid_tabpage(tp))
tabpage_close_other(tp, eap->forceit); done = 1000;
// if we failed to close it quit // start over, "tp" is now invalid
if (valid_tabpage(tp)) break;
done = 1000;
// start over, "tp" is now invalid
break;
}
if (first_tabpage->tp_next == NULL)
break;
} }
} if (first_tabpage->tp_next == NULL)
break;
} }
} }
@@ -6375,30 +6390,30 @@ ex_only(exarg_T *eap)
ex_hide(exarg_T *eap UNUSED) ex_hide(exarg_T *eap UNUSED)
{ {
// ":hide" or ":hide | cmd": hide current window // ":hide" or ":hide | cmd": hide current window
if (!eap->skip) if (eap->skip)
{ return;
if (window_layout_locked(CMD_hide))
return;
#ifdef FEAT_GUI
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;
FOR_ALL_WINDOWS(win) if (window_layout_locked(CMD_hide))
{ return;
winnr++; #ifdef FEAT_GUI
if (winnr == eap->line2) need_mouse_correct = TRUE;
break; #endif
} if (eap->addr_count == 0)
if (win == NULL) win_close(curwin, FALSE); // don't free buffer
win = lastwin; else
win_close(win, FALSE); {
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);
} }
} }
@@ -6411,26 +6426,26 @@ ex_stop(exarg_T *eap)
/* /*
* Disallow suspending for "rvim". * Disallow suspending for "rvim".
*/ */
if (!check_restricted()) if (check_restricted())
{ return;
if (!eap->forceit)
autowrite_all(); if (!eap->forceit)
apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, FALSE, NULL); autowrite_all();
windgoto((int)Rows - 1, 0); apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, FALSE, NULL);
out_char('\n'); windgoto((int)Rows - 1, 0);
out_flush(); out_char('\n');
stoptermcap(); out_flush();
out_flush(); // needed for SUN to restore xterm buffer stoptermcap();
mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles out_flush(); // needed for SUN to restore xterm buffer
ui_suspend(); // call machine specific function mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles
maketitle(); ui_suspend(); // call machine specific function
resettitle(); // force updating the title maketitle();
starttermcap(); resettitle(); // force updating the title
scroll_start(); // scroll screen before redrawing starttermcap();
redraw_later_clear(); scroll_start(); // scroll screen before redrawing
shell_resized(); // may have resized window redraw_later_clear();
apply_autocmds(EVENT_VIMRESUME, NULL, NULL, FALSE, NULL); 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; linenr_T lnum;
if (eap->usefilter) // :r!cmd if (eap->usefilter) // :r!cmd
do_bang(1, eap, FALSE, FALSE, TRUE);
else
{ {
if (u_save(eap->line2, (linenr_T)(eap->line2 + 1)) == FAIL) do_bang(1, eap, FALSE, FALSE, TRUE);
return; return;
}
if (u_save(eap->line2, (linenr_T)(eap->line2 + 1)) == FAIL)
return;
#ifdef FEAT_BROWSE #ifdef FEAT_BROWSE
if (cmdmod.cmod_flags & CMOD_BROWSE) if (cmdmod.cmod_flags & CMOD_BROWSE)
{ {
char_u *browseFile; char_u *browseFile;
browseFile = do_browse(0, (char_u *)_("Append File"), eap->arg, browseFile = do_browse(0, (char_u *)_("Append File"), eap->arg,
NULL, NULL, NULL, curbuf); NULL, NULL, NULL, curbuf);
if (browseFile != NULL) if (browseFile != NULL)
{ {
i = readfile(browseFile, NULL, i = readfile(browseFile, NULL,
eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0);
vim_free(browseFile); vim_free(browseFile);
}
else
i = OK;
} }
else else
i = OK;
}
else
#endif #endif
if (*eap->arg == NUL) if (*eap->arg == NUL)
{ {
if (check_fname() == FAIL) // check for no file name if (check_fname() == FAIL) // check for no file name
return; return;
i = readfile(curbuf->b_ffname, curbuf->b_fname, 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 else
{ {
if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL) if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL)
(void)setaltfname(eap->arg, eap->arg, (linenr_T)1); (void)setaltfname(eap->arg, eap->arg, (linenr_T)1);
i = readfile(eap->arg, NULL, 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 defined(FEAT_EVAL)
if (!aborting()) if (!aborting())
#endif #endif
semsg(_(e_cant_open_file_str), eap->arg); semsg(_(e_cant_open_file_str), eap->arg);
} }
else 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 ml_delete(lnum);
// this but vi doesn't. if (curwin->w_cursor.lnum > 1
if (eap->line2 == 0) && curwin->w_cursor.lnum >= lnum)
lnum = curbuf->b_ml.ml_line_count; --curwin->w_cursor.lnum;
else deleted_lines_mark(lnum, 1L);
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);
}
} }
redraw_curbuf_later(UPD_VALID);
} }
redraw_curbuf_later(UPD_VALID);
} }
} }
@@ -7675,23 +7691,24 @@ ex_cd(exarg_T *eap)
#if !defined(UNIX) && !defined(VMS) #if !defined(UNIX) && !defined(VMS)
// for non-UNIX ":cd" means: print current directory unless 'cdhome' is set // for non-UNIX ":cd" means: print current directory unless 'cdhome' is set
if (*new_dir == NUL && !p_cdh) if (*new_dir == NUL && !p_cdh)
ex_pwd(NULL);
else
#endif
{ {
cdscope_T scope = CDSCOPE_GLOBAL; ex_pwd(NULL);
return;
}
#endif
if (eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir) cdscope_T scope = CDSCOPE_GLOBAL;
scope = CDSCOPE_WINDOW;
else if (eap->cmdidx == CMD_tcd || eap->cmdidx == CMD_tchdir)
scope = CDSCOPE_TABPAGE;
if (changedir_func(new_dir, eap->forceit, scope)) if (eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir)
{ scope = CDSCOPE_WINDOW;
// Echo the new current directory if the command was typed. else if (eap->cmdidx == CMD_tcd || eap->cmdidx == CMD_tchdir)
if (KeyTyped || p_verbose >= 5) scope = CDSCOPE_TABPAGE;
ex_pwd(eap);
} 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) == FAIL)
{ {
beep_flush(); beep_flush();
return;
} }
else
{
int save_efr = exec_from_reg;
exec_from_reg = TRUE; int save_efr = exec_from_reg;
/* exec_from_reg = TRUE;
* 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; /*
} * 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; return;
#endif #endif
if (*eap->arg == NUL) // No argument? 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
{ {
pos = curwin->w_cursor; // save curwin->w_cursor emsg(_(e_argument_required));
curwin->w_cursor.lnum = eap->line2; return;
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
} }
if (eap->arg[1] != NUL) // more than one character?
{
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 static void
ex_setfiletype(exarg_T *eap) ex_setfiletype(exarg_T *eap)
{ {
if (!did_filetype) if (did_filetype)
{ return;
char_u *arg = eap->arg;
if (STRNCMP(arg, "FALLBACK ", 9) == 0) char_u *arg = eap->arg;
arg += 9; if (STRNCMP(arg, "FALLBACK ", 9) == 0)
arg += 9;
set_option_value_give_err((char_u *)"filetype", 0L, arg, OPT_LOCAL); set_option_value_give_err((char_u *)"filetype", 0L, arg, OPT_LOCAL);
if (arg != eap->arg) if (arg != eap->arg)
did_filetype = FALSE; did_filetype = FALSE;
}
} }
static void static void

View File

@@ -368,36 +368,36 @@ finish_incsearch_highlighting(
incsearch_state_T *is_state, incsearch_state_T *is_state,
int call_update_screen) 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 (!EQUAL_POS(is_state->save_cursor, is_state->search_start))
if (gotesc)
curwin->w_cursor = is_state->save_cursor;
else
{ {
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;
// put the '" mark at the original position setpcmark();
curwin->w_cursor = is_state->save_cursor;
setpcmark();
}
curwin->w_cursor = is_state->search_start;
} }
restore_viewstate(&is_state->old_viewstate); curwin->w_cursor = is_state->search_start;
highlight_match = FALSE;
// by default search all lines
search_first_line = 0;
search_last_line = MAXLNUM;
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);
} }
restore_viewstate(&is_state->old_viewstate);
highlight_match = FALSE;
// by default search all lines
search_first_line = 0;
search_last_line = MAXLNUM;
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);
} }
/* /*
@@ -4032,13 +4032,13 @@ escape_fname(char_u **pp)
char_u *p; char_u *p;
p = alloc(STRLEN(*pp) + 2); p = alloc(STRLEN(*pp) + 2);
if (p != NULL) if (p == NULL)
{ return;
p[0] = '\\';
STRCPY(p + 1, *pp); p[0] = '\\';
vim_free(*pp); STRCPY(p + 1, *pp);
*pp = p; vim_free(*pp);
} *pp = p;
} }
/* /*

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1115,
/**/ /**/
1114, 1114,
/**/ /**/