forked from aniani/vim
updated for version 7.0182
This commit is contained in:
@@ -1806,10 +1806,11 @@ buflist_getfile(n, lnum, options, forceit)
|
||||
if (buf == curbuf)
|
||||
return OK;
|
||||
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
if (editing_cmdline())
|
||||
{
|
||||
editing_cmdline_msg();
|
||||
return FAIL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* altfpos may be changed by getfile(), get it now */
|
||||
if (lnum == 0)
|
||||
|
||||
@@ -2026,7 +2026,17 @@ do_one_cmd(cmdlinep, sourcing,
|
||||
}
|
||||
else if (ea.addr_count != 0)
|
||||
{
|
||||
if (ea.line2 < 0 || ea.line2 > curbuf->b_ml.ml_line_count)
|
||||
if (ea.line2 > curbuf->b_ml.ml_line_count)
|
||||
{
|
||||
/* With '-' in 'cpoptions' a line number past the file is an
|
||||
* error, otherwise put it at the end of the file. */
|
||||
if (vim_strchr(p_cpo, CPO_MINUS) != NULL)
|
||||
ea.line2 = -1;
|
||||
else
|
||||
ea.line2 = curbuf->b_ml.ml_line_count;
|
||||
}
|
||||
|
||||
if (ea.line2 < 0)
|
||||
errormsg = (char_u *)_(e_invrange);
|
||||
else
|
||||
{
|
||||
@@ -2126,18 +2136,22 @@ do_one_cmd(cmdlinep, sourcing,
|
||||
errormsg = (char_u *)_(e_modifiable);
|
||||
goto doend;
|
||||
}
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0 && !(ea.argt & CMDWIN)
|
||||
|
||||
if (editing_cmdline() && !(ea.argt & CMDWIN)
|
||||
# ifdef FEAT_USR_CMDS
|
||||
&& !USER_CMDIDX(ea.cmdidx)
|
||||
# endif
|
||||
)
|
||||
{
|
||||
/* Command not allowed in cmdline window. */
|
||||
errormsg = (char_u *)_(e_cmdwin);
|
||||
/* Command not allowed when editing the command line. */
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
errormsg = (char_u *)_(e_cmdwin);
|
||||
else
|
||||
#endif
|
||||
errormsg = (char_u *)_(e_secure);
|
||||
goto doend;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0)
|
||||
{
|
||||
@@ -2977,12 +2991,9 @@ set_one_cmd_context(xp, buff)
|
||||
int forceit = FALSE;
|
||||
int usefilter = FALSE; /* filter instead of file name */
|
||||
|
||||
ExpandInit(xp);
|
||||
xp->xp_pattern = buff;
|
||||
xp->xp_context = EXPAND_COMMANDS; /* Default until we get past command */
|
||||
xp->xp_backslash = XP_BS_NONE;
|
||||
#if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
|
||||
xp->xp_arg = NULL;
|
||||
#endif
|
||||
ea.argt = 0;
|
||||
|
||||
/*
|
||||
@@ -3254,6 +3265,11 @@ set_one_cmd_context(xp, buff)
|
||||
if (bow != NULL && in_quote)
|
||||
xp->xp_pattern = bow;
|
||||
xp->xp_context = EXPAND_FILES;
|
||||
#ifndef BACKSLASH_IN_FILENAME
|
||||
/* For a shell command more chars need to be escaped. */
|
||||
if (usefilter || ea.cmdidx == CMD_bang)
|
||||
xp->xp_shell = TRUE;
|
||||
#endif
|
||||
|
||||
/* Check for environment variable */
|
||||
if (*xp->xp_pattern == '$'
|
||||
@@ -4189,16 +4205,16 @@ expand_filename(eap, cmdlinep, errormsgp)
|
||||
|
||||
/* For a shell command a '!' must be escaped. */
|
||||
if ((eap->usefilter || eap->cmdidx == CMD_bang)
|
||||
&& vim_strpbrk(repl, (char_u *)"!&;()") != NULL)
|
||||
&& vim_strpbrk(repl, (char_u *)"!&;()<>") != NULL)
|
||||
{
|
||||
char_u *l;
|
||||
|
||||
l = vim_strsave_escaped(repl, (char_u *)"!&;()");
|
||||
l = vim_strsave_escaped(repl, (char_u *)"!&;()<>");
|
||||
if (l != NULL)
|
||||
{
|
||||
vim_free(repl);
|
||||
repl = l;
|
||||
/* For a sh-like shell escape it another time. */
|
||||
/* For a sh-like shell escape "!" another time. */
|
||||
if (strstr((char *)p_sh, "sh") != NULL)
|
||||
{
|
||||
l = vim_strsave_escaped(repl, (char_u *)"!");
|
||||
@@ -6017,6 +6033,12 @@ ex_quit(eap)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* Don't quit while editing the command line. */
|
||||
if (editing_cmdline())
|
||||
{
|
||||
editing_cmdline_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
netbeansForcedQuit = eap->forceit;
|
||||
@@ -6079,6 +6101,14 @@ ex_quit_all(eap)
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
/* Don't quit while editing the command line. */
|
||||
if (editing_cmdline())
|
||||
{
|
||||
editing_cmdline_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
exiting = TRUE;
|
||||
if (eap->forceit || !check_changed_any(FALSE))
|
||||
getout(0);
|
||||
@@ -6098,7 +6128,8 @@ ex_close(eap)
|
||||
cmdwin_result = K_IGNORE;
|
||||
else
|
||||
# endif
|
||||
ex_win_close(eap, curwin);
|
||||
if (!editing_cmdline())
|
||||
ex_win_close(eap, curwin);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -6257,6 +6288,12 @@ ex_exit(eap)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* Don't quit while editing the command line. */
|
||||
if (editing_cmdline())
|
||||
{
|
||||
editing_cmdline_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* if more files or windows we won't exit
|
||||
@@ -6369,10 +6406,9 @@ handle_drop(filec, filev, split)
|
||||
exarg_T ea;
|
||||
int save_msg_scroll = msg_scroll;
|
||||
|
||||
# ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
/* Postpone this while editing the command line. */
|
||||
if (editing_cmdline())
|
||||
return;
|
||||
# endif
|
||||
|
||||
/* Check whether the current buffer is changed. If so, we will need
|
||||
* to split the current window or data could be lost.
|
||||
|
||||
21
src/normal.c
21
src/normal.c
@@ -788,15 +788,14 @@ getcount:
|
||||
clearopbeep(oap);
|
||||
goto normal_end;
|
||||
}
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0 && (nv_cmds[idx].cmd_flags & NV_NCW))
|
||||
|
||||
if (editing_cmdline() && (nv_cmds[idx].cmd_flags & NV_NCW))
|
||||
{
|
||||
/* This command is not allowed in the cmdline window: beep. */
|
||||
/* This command is not allowed wile editing a ccmdline: beep. */
|
||||
clearopbeep(oap);
|
||||
EMSG(_(e_cmdwin));
|
||||
editing_cmdline_msg();
|
||||
goto normal_end;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_VISUAL
|
||||
/*
|
||||
@@ -3640,6 +3639,7 @@ add_to_showcmd(c)
|
||||
K_RIGHTMOUSE, K_RIGHTDRAG, K_RIGHTRELEASE,
|
||||
K_MOUSEDOWN, K_MOUSEUP,
|
||||
K_X1MOUSE, K_X1DRAG, K_X1RELEASE, K_X2MOUSE, K_X2DRAG, K_X2RELEASE,
|
||||
K_CURSORHOLD,
|
||||
0
|
||||
};
|
||||
#endif
|
||||
@@ -5741,13 +5741,12 @@ nv_gotofile(cap)
|
||||
{
|
||||
char_u *ptr;
|
||||
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
if (editing_cmdline())
|
||||
{
|
||||
clearopbeep(cap->oap);
|
||||
editing_cmdline_msg();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
ptr = grab_file_name(cap->count1);
|
||||
|
||||
@@ -7802,13 +7801,13 @@ nv_g_cmd(cap)
|
||||
|
||||
/* "gQ": improved Ex mode */
|
||||
case 'Q':
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
if (editing_cmdline())
|
||||
{
|
||||
clearopbeep(cap->oap);
|
||||
editing_cmdline_msg();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!checkclearopq(oap))
|
||||
do_exmode(TRUE);
|
||||
break;
|
||||
|
||||
@@ -4852,7 +4852,7 @@ mch_expandpath(gap, path, flags)
|
||||
# define SEEK_END 2
|
||||
#endif
|
||||
|
||||
#define SHELL_SPECIAL (char_u *)"\t \"&';<>[\\]|"
|
||||
#define SHELL_SPECIAL (char_u *)"\t \"&';<>\\|"
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* ex_getln.c */
|
||||
char_u *getcmdline __ARGS((int firstc, long count, int indent));
|
||||
char_u *getcmdline_prompt __ARGS((int firstc, char_u *prompt, int attr, int xp_context, char_u *xp_arg));
|
||||
int editing_cmdline __ARGS((void));
|
||||
void editing_cmdline_msg __ARGS((void));
|
||||
char_u *getexline __ARGS((int c, void *dummy, int indent));
|
||||
char_u *getexmodeline __ARGS((int promptc, void *dummy, int indent));
|
||||
int cmdline_overstrike __ARGS((void));
|
||||
|
||||
@@ -324,6 +324,7 @@
|
||||
# else
|
||||
# define PATH_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|")
|
||||
# endif
|
||||
# define SHELL_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|<>();&!")
|
||||
#endif
|
||||
|
||||
#define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */
|
||||
|
||||
@@ -2717,13 +2717,13 @@ win_alloc_first()
|
||||
win_goto(wp)
|
||||
win_T *wp;
|
||||
{
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
if (editing_cmdline())
|
||||
{
|
||||
beep_flush();
|
||||
editing_cmdline_msg();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_VISUAL
|
||||
if (wp->w_buffer != curbuf)
|
||||
reset_VIsual_and_resel();
|
||||
|
||||
Reference in New Issue
Block a user