Compare commits

...

5 Commits

Author SHA1 Message Date
Bram Moolenaar
8e8fe9b2b8 updated for version 7.2-136 2009-03-11 14:37:32 +00:00
Bram Moolenaar
60f39aecb1 updated for version 7.2-135 2009-03-11 14:10:38 +00:00
Bram Moolenaar
5d294d19b4 updated for version 7.2-134 2009-03-11 12:11:02 +00:00
Bram Moolenaar
21fa1ed4b5 updated for version 7.2-133 2009-03-11 11:47:18 +00:00
Bram Moolenaar
bf1b7a7efe updated for version 7.2-132 2009-03-05 02:15:53 +00:00
7 changed files with 103 additions and 12 deletions

View File

@@ -1153,7 +1153,7 @@ ex_diffoff(eap)
for (wp = firstwin; wp != NULL; wp = wp->w_next)
{
if (wp == curwin || eap->forceit)
if (wp == curwin || (eap->forceit && wp->w_p_diff))
{
/* Set 'diff', 'scrollbind' off and 'wrap' on. */
wp->w_p_diff = FALSE;

View File

@@ -5124,7 +5124,11 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force)
}
vim_free(cmd->uc_rep);
cmd->uc_rep = 0;
cmd->uc_rep = NULL;
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
vim_free(cmd->uc_compl_arg);
cmd->uc_compl_arg = NULL;
#endif
break;
}
@@ -5941,7 +5945,7 @@ do_ucmd(eap)
for (;;)
{
p = cmd->uc_rep; /* source */
q = buf; /* destinateion */
q = buf; /* destination */
totlen = 0;
for (;;)
@@ -7846,6 +7850,9 @@ free_cd_dir()
{
vim_free(prev_dir);
prev_dir = NULL;
vim_free(globaldir);
globaldir = NULL;
}
#endif
@@ -7868,6 +7875,10 @@ ex_cd(eap)
else
#endif
{
#ifdef FEAT_AUTOCMD
if (allbuf_locked())
return;
#endif
if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged()
&& !eap->forceit)
{

View File

@@ -2000,8 +2000,8 @@ text_locked_msg()
#if defined(FEAT_AUTOCMD) || defined(PROTO)
/*
* Check if "curbuf_lock" is set and return TRUE when it is and give an error
* message.
* Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is
* and give an error message.
*/
int
curbuf_locked()
@@ -2011,6 +2011,21 @@ curbuf_locked()
EMSG(_("E788: Not allowed to edit another buffer now"));
return TRUE;
}
return allbuf_locked();
}
/*
* Check if "allbuf_lock" is set and return TRUE when it is and give an error
* message.
*/
int
allbuf_locked()
{
if (allbuf_lock > 0)
{
EMSG(_("E811: Not allowed to change buffer information now"));
return TRUE;
}
return FALSE;
}
#endif

View File

@@ -69,7 +69,7 @@ static int apply_autocmds_exarg __ARGS((event_T event, char_u *fname, char_u *fn
static int au_find_group __ARGS((char_u *name));
# define AUGROUP_DEFAULT -1 /* default autocmd group */
# define AUGROUP_ERROR -2 /* errornouse autocmd group */
# define AUGROUP_ERROR -2 /* erroneous autocmd group */
# define AUGROUP_ALL -3 /* all autocmd groups */
#endif
@@ -144,7 +144,9 @@ static int get_mac_fio_flags __ARGS((char_u *ptr));
# endif
#endif
static int move_lines __ARGS((buf_T *frombuf, buf_T *tobuf));
#ifdef FEAT_AUTOCMD
static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
#endif
void
filemess(buf, name, s, attr)
@@ -295,6 +297,19 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
int conv_restlen = 0; /* nr of bytes in conv_rest[] */
#endif
#ifdef FEAT_AUTOCMD
/* Remember the initial values of curbuf, curbuf->b_ffname and
* curbuf->b_fname to detect whether they are altered as a result of
* executing nasty autocommands. Also check if "fname" and "sfname"
* point to one of these values. */
buf_T *old_curbuf = curbuf;
char_u *old_b_ffname = curbuf->b_ffname;
char_u *old_b_fname = curbuf->b_fname;
int using_b_ffname = (fname == curbuf->b_ffname)
|| (sfname == curbuf->b_ffname);
int using_b_fname = (fname == curbuf->b_fname)
|| (sfname == curbuf->b_fname);
#endif
write_no_eol_lnum = 0; /* in case it was set by the previous read */
/*
@@ -589,7 +604,21 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
#ifdef FEAT_QUICKFIX
if (!bt_dontwrite(curbuf))
#endif
{
check_need_swap(newfile);
#ifdef FEAT_AUTOCMD
/* SwapExists autocommand may mess things up */
if (curbuf != old_curbuf
|| (using_b_ffname
&& (old_b_ffname != curbuf->b_ffname))
|| (using_b_fname
&& (old_b_fname != curbuf->b_fname)))
{
EMSG(_(e_auchangedbuf));
return FAIL;
}
#endif
}
if (dir_of_file_exists(fname))
filemess(curbuf, sfname, (char_u *)_("[New File]"), 0);
else
@@ -668,6 +697,17 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
#endif
{
check_need_swap(newfile);
#ifdef FEAT_AUTOCMD
if (!read_stdin && (curbuf != old_curbuf
|| (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
|| (using_b_fname && (old_b_fname != curbuf->b_fname))))
{
EMSG(_(e_auchangedbuf));
if (!read_buffer)
close(fd);
return FAIL;
}
#endif
#ifdef UNIX
/* Set swap file protection bits after creating it. */
if (swap_mode > 0 && curbuf->b_ml.ml_mfp->mf_fname != NULL)
@@ -698,7 +738,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
{
int m = msg_scroll;
int n = msg_scrolled;
buf_T *old_curbuf = curbuf;
/*
* The file must be closed again, the autocommands may want to change
@@ -740,8 +779,13 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
/*
* Don't allow the autocommands to change the current buffer.
* Try to re-open the file.
*
* Don't allow the autocommands to change the buffer name either
* (cd for example) if it invalidates fname or sfname.
*/
if (!read_stdin && (curbuf != old_curbuf
|| (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
|| (using_b_fname && (old_b_fname != curbuf->b_fname))
|| (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) < 0))
{
--no_wait_return;
@@ -5244,13 +5288,16 @@ buf_write_bytes(ip)
/* Convert with iconv(). */
if (ip->bw_restlen > 0)
{
char *fp;
/* Need to concatenate the remainder of the previous call and
* the bytes of the current call. Use the end of the
* conversion buffer for this. */
fromlen = len + ip->bw_restlen;
from = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen;
mch_memmove((void *)from, ip->bw_rest, (size_t)ip->bw_restlen);
mch_memmove((void *)(from + ip->bw_restlen), buf, (size_t)len);
fp = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen;
mch_memmove(fp, ip->bw_rest, (size_t)ip->bw_restlen);
mch_memmove(fp + ip->bw_restlen, buf, (size_t)len);
from = fp;
tolen = ip->bw_conv_buflen - fromlen;
}
else
@@ -6320,7 +6367,7 @@ check_timestamps(focus)
if (!stuff_empty() || global_busy || !typebuf_typed()
#ifdef FEAT_AUTOCMD
|| autocmd_busy || curbuf_lock > 0
|| autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0
#endif
)
need_check_timestamps = TRUE; /* check later */
@@ -6522,8 +6569,10 @@ buf_check_timestamp(buf, focus)
set_vim_var_string(VV_FCS_REASON, (char_u *)reason, -1);
set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", -1);
# endif
++allbuf_lock;
n = apply_autocmds(EVENT_FILECHANGEDSHELL,
buf->b_fname, buf->b_fname, FALSE, buf);
--allbuf_lock;
busy = FALSE;
if (n)
{

View File

@@ -619,6 +619,11 @@ EXTERN int textlock INIT(= 0);
EXTERN int curbuf_lock INIT(= 0);
/* non-zero when the current buffer can't be
* changed. Used for FileChangedRO. */
EXTERN int allbuf_lock INIT(= 0);
/* non-zero when no buffer name can be
* changed, no buffer can be deleted and
* current directory can't be changed.
* Used for SwapExists et al. */
#endif
#ifdef FEAT_EVAL
# define HAVE_SANDBOX

View File

@@ -4,6 +4,7 @@ char_u *getcmdline_prompt __ARGS((int firstc, char_u *prompt, int attr, int xp_c
int text_locked __ARGS((void));
void text_locked_msg __ARGS((void));
int curbuf_locked __ARGS((void));
int allbuf_locked __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));

View File

@@ -676,6 +676,16 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
136,
/**/
135,
/**/
134,
/**/
133,
/**/
132,
/**/
131,
/**/