forked from aniani/vim
updated for version 7.0182
This commit is contained in:
@@ -289,6 +289,13 @@ edit(cmdchar, startln, count)
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
/* Don't allow changes in the buffer while editing the cmdline. The
|
||||
* caller of getcmdline() may get confused. */
|
||||
if (cmdline_busy)
|
||||
{
|
||||
EMSG(_(e_secure));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef FEAT_INS_EXPAND
|
||||
ins_compl_clear(); /* clear stuff for CTRL-X mode */
|
||||
|
||||
@@ -2841,11 +2841,11 @@ check_readonly(forceit, buf)
|
||||
}
|
||||
|
||||
/*
|
||||
* try to abandon current file and edit a new or existing file
|
||||
* 'fnum' is the number of the file, if zero use ffname/sfname
|
||||
* Try to abandon current file and edit a new or existing file.
|
||||
* 'fnum' is the number of the file, if zero use ffname/sfname.
|
||||
*
|
||||
* return 1 for "normal" error, 2 for "not written" error, 0 for success
|
||||
* -1 for succesfully opening another file
|
||||
* Return 1 for "normal" error, 2 for "not written" error, 0 for success
|
||||
* -1 for succesfully opening another file.
|
||||
* 'lnum' is the line number for the cursor in the new file (if non-zero).
|
||||
*/
|
||||
int
|
||||
@@ -2861,10 +2861,8 @@ getfile(fnum, ffname, sfname, setpm, lnum, forceit)
|
||||
int retval;
|
||||
char_u *free_me = NULL;
|
||||
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
if (editing_cmdline())
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
if (fnum == 0)
|
||||
{
|
||||
|
||||
@@ -258,6 +258,9 @@ getcmdline(firstc, count, indent)
|
||||
}
|
||||
xpc.xp_context = EXPAND_NOTHING;
|
||||
xpc.xp_backslash = XP_BS_NONE;
|
||||
#ifndef BACKSLASH_IN_FILENAME
|
||||
xpc.xp_shell = FALSE;
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_EVAL)
|
||||
if (ccline.input_fn)
|
||||
@@ -658,17 +661,13 @@ getcmdline(firstc, count, indent)
|
||||
restore_cmdline(&save_ccline);
|
||||
if (c == '=')
|
||||
{
|
||||
/* Need to save and restore ccline. And go into the
|
||||
* sandbox to avoid nasty things like going to another
|
||||
* buffer when evaluating an expression. */
|
||||
/* Need to save and restore ccline. And set cmdline_busy
|
||||
* to avoid nasty things like going to another buffer when
|
||||
* evaluating an expression. */
|
||||
save_cmdline(&save_ccline);
|
||||
#ifdef HAVE_SANDBOX
|
||||
++sandbox;
|
||||
#endif
|
||||
++cmdline_busy;
|
||||
p = get_expr_line();
|
||||
#ifdef HAVE_SANDBOX
|
||||
--sandbox;
|
||||
#endif
|
||||
--cmdline_busy;
|
||||
restore_cmdline(&save_ccline);
|
||||
|
||||
if (p != NULL && realloc_cmdbuff((int)STRLEN(p) + 1) == OK)
|
||||
@@ -1875,6 +1874,35 @@ getcmdline_prompt(firstc, prompt, attr, xp_context, xp_arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return TRUE when the command line is being edited. That means the current
|
||||
* buffer and window can't be changed.
|
||||
*/
|
||||
int
|
||||
editing_cmdline()
|
||||
{
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
return TRUE;
|
||||
#endif
|
||||
return cmdline_busy;
|
||||
}
|
||||
|
||||
/*
|
||||
* Give an error message for a command that isn't allowed while the cmdline
|
||||
* window is open or editing the cmdline in another way.
|
||||
*/
|
||||
void
|
||||
editing_cmdline_msg()
|
||||
{
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
EMSG(_(e_cmdwin));
|
||||
else
|
||||
#endif
|
||||
EMSG(_(e_secure));
|
||||
}
|
||||
|
||||
static int
|
||||
cmdline_charsize(idx)
|
||||
int idx;
|
||||
@@ -2786,17 +2814,12 @@ cmdline_paste(regname, literally)
|
||||
regname = may_get_selection(regname);
|
||||
#endif
|
||||
|
||||
/* Need to save and restore ccline. And go into the sandbox to avoid
|
||||
* nasty things like going to another buffer when evaluating an
|
||||
* expression. */
|
||||
/* Need to save and restore ccline. And set cmdline_busy to avoid nasty
|
||||
* things like going to another buffer when evaluating an expression. */
|
||||
save_cmdline(&save_ccline);
|
||||
#ifdef HAVE_SANDBOX
|
||||
++sandbox;
|
||||
#endif
|
||||
++cmdline_busy;
|
||||
i = get_spec_reg(regname, &arg, &allocated, TRUE);
|
||||
#ifdef HAVE_SANDBOX
|
||||
--sandbox;
|
||||
#endif
|
||||
--cmdline_busy;
|
||||
restore_cmdline(&save_ccline);
|
||||
|
||||
if (i)
|
||||
@@ -3368,8 +3391,14 @@ ExpandInit(xp)
|
||||
expand_T *xp;
|
||||
{
|
||||
xp->xp_backslash = XP_BS_NONE;
|
||||
#ifndef BACKSLASH_IN_FILENAME
|
||||
xp->xp_shell = FALSE;
|
||||
#endif
|
||||
xp->xp_numfiles = -1;
|
||||
xp->xp_files = NULL;
|
||||
#if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
|
||||
xp->xp_arg = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3446,7 +3475,8 @@ ExpandEscape(xp, str, numfiles, files, options)
|
||||
p = vim_strsave_escaped(files[i], buf);
|
||||
}
|
||||
#else
|
||||
p = vim_strsave_escaped(files[i], PATH_ESC_CHARS);
|
||||
p = vim_strsave_escaped(files[i],
|
||||
xp->xp_shell ? SHELL_ESC_CHARS : PATH_ESC_CHARS);
|
||||
#endif
|
||||
if (p != NULL)
|
||||
{
|
||||
@@ -4527,8 +4557,9 @@ globpath(path, file)
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
||||
ExpandInit(&xpc);
|
||||
xpc.xp_context = EXPAND_FILES;
|
||||
xpc.xp_backslash = XP_BS_NONE;
|
||||
|
||||
ga_init2(&ga, 1, 100);
|
||||
|
||||
/* Loop over all entries in {path}. */
|
||||
|
||||
@@ -86,6 +86,8 @@ EXTERN int clear_cmdline INIT(= FALSE); /* cmdline must be cleared */
|
||||
#if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
|
||||
EXTERN int cmdline_star INIT(= FALSE); /* cmdline is crypted */
|
||||
#endif
|
||||
EXTERN int cmdline_busy INIT(= FALSE); /* editing the cmdline */
|
||||
|
||||
EXTERN int exec_from_reg INIT(= FALSE); /* executing register */
|
||||
|
||||
EXTERN int screen_cleared INIT(= FALSE); /* screen has been cleared */
|
||||
|
||||
@@ -2328,7 +2328,6 @@ sm_client_die(GnomeClient *client, gpointer data)
|
||||
vim_strncpy(IObuff,
|
||||
_("Vim: Received \"die\" request from session manager\n"),
|
||||
IOSIZE - 1);
|
||||
deadly_exit = TRUE;
|
||||
preserve_exit();
|
||||
}
|
||||
|
||||
|
||||
@@ -401,6 +401,10 @@ typedef struct expand
|
||||
int xp_scriptID; /* SID for completion function */
|
||||
#endif
|
||||
int xp_backslash; /* one of the XP_BS_ values */
|
||||
#ifndef BACKSLASH_IN_FILENAME
|
||||
int xp_shell; /* for a shell command more characters
|
||||
need to be escaped */
|
||||
#endif
|
||||
int xp_numfiles; /* number of files found by
|
||||
file name completion */
|
||||
char_u **xp_files; /* list of files */
|
||||
|
||||
72
src/undo.c
72
src/undo.c
@@ -52,6 +52,7 @@
|
||||
|
||||
static u_entry_T *u_get_headentry __ARGS((void));
|
||||
static void u_getbot __ARGS((void));
|
||||
static int undo_allowed __ARGS((void));
|
||||
static int u_savecommon __ARGS((linenr_T, linenr_T, linenr_T));
|
||||
static void u_doit __ARGS((int count));
|
||||
static void u_undoredo __ARGS((void));
|
||||
@@ -156,6 +157,40 @@ u_savedel(lnum, nlines)
|
||||
nlines == curbuf->b_ml.ml_line_count ? 2 : lnum));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE when undo is allowed. Otherwise give an error message and
|
||||
* return FALSE.
|
||||
*/
|
||||
static int
|
||||
undo_allowed()
|
||||
{
|
||||
/* Don't allow changes when 'modifiable' is off. */
|
||||
if (!curbuf->b_p_ma)
|
||||
{
|
||||
EMSG(_(e_modifiable));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SANDBOX
|
||||
/* In the sandbox it's not allowed to change the text. */
|
||||
if (sandbox != 0)
|
||||
{
|
||||
EMSG(_(e_sandbox));
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Don't allow changes in the buffer while editing the cmdline. The
|
||||
* caller of getcmdline() may get confused. */
|
||||
if (cmdline_busy)
|
||||
{
|
||||
EMSG(_(e_secure));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
u_savecommon(top, bot, newbot)
|
||||
linenr_T top, bot;
|
||||
@@ -168,27 +203,10 @@ u_savecommon(top, bot, newbot)
|
||||
u_entry_T *prev_uep;
|
||||
long size;
|
||||
|
||||
/*
|
||||
* Don't allow changes when 'modifiable' is off. Letting the
|
||||
* undo fail is a crude way to make all change commands fail.
|
||||
*/
|
||||
if (!curbuf->b_p_ma)
|
||||
{
|
||||
EMSG(_(e_modifiable));
|
||||
/* When making changes is not allowed return FAIL. It's a crude way to
|
||||
* make all change commands fail. */
|
||||
if (!undo_allowed())
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SANDBOX
|
||||
/*
|
||||
* In the sandbox it's not allowed to change the text. Letting the
|
||||
* undo fail is a crude way to make all change commands fail.
|
||||
*/
|
||||
if (sandbox != 0)
|
||||
{
|
||||
EMSG(_(e_sandbox));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
/*
|
||||
@@ -484,20 +502,8 @@ u_redo(count)
|
||||
u_doit(count)
|
||||
int count;
|
||||
{
|
||||
/* Don't allow changes when 'modifiable' is off. */
|
||||
if (!curbuf->b_p_ma)
|
||||
{
|
||||
EMSG(_(e_modifiable));
|
||||
if (!undo_allowed())
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_SANDBOX
|
||||
/* In the sandbox it's not allowed to change the text. */
|
||||
if (sandbox != 0)
|
||||
{
|
||||
EMSG(_(e_sandbox));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
u_newcount = 0;
|
||||
u_oldcount = 0;
|
||||
|
||||
@@ -36,5 +36,5 @@
|
||||
#define VIM_VERSION_NODOT "vim70aa"
|
||||
#define VIM_VERSION_SHORT "7.0aa"
|
||||
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
|
||||
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 14)"
|
||||
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 14, compiled "
|
||||
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 19)"
|
||||
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Jan 19, compiled "
|
||||
|
||||
Reference in New Issue
Block a user