Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merged from the latest developing branch.

git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@1540 2a77ed30-b011-0410-a7ad-c7884a0aa172
  • Loading branch information...
commit bc7e5641849b5e45c164601ba06cebf6c6389c2e 1 parent 4f92679
edyfox authored
View
12 runtime/doc/autocmd.txt
@@ -335,6 +335,8 @@ BufDelete Before deleting a buffer from the buffer list.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being deleted "<afile>" and "<abuf>".
+ Don't change to another buffer, it will cause
+ problems.
*BufEnter*
BufEnter After entering a buffer. Useful for setting
options for a file type. Also executed when
@@ -397,6 +399,8 @@ BufUnload Before unloading a buffer. This is when the
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being unloaded "<afile>".
+ Don't change to another buffer, it will cause
+ problems.
*BufWinEnter*
BufWinEnter After a buffer is displayed in a window. This
can be when the buffer is loaded (after
@@ -428,6 +432,8 @@ BufWipeout Before completely deleting a buffer. The
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being deleted "<afile>".
+ Don't change to another buffer, it will cause
+ problems.
*BufWrite* *BufWritePre*
BufWrite or BufWritePre Before writing the whole buffer to a file.
*BufWriteCmd*
@@ -748,8 +754,10 @@ SwapExists Detected an existing swap file when starting
'a' abort, like hitting CTRL-C
When set to an empty string the user will be
asked, as if there was no SwapExists autocmd.
- Note: Do not try to change the buffer, the
- results are unpredictable.
+ *E812*
+ It is not allowed to change to another buffer,
+ change a buffer name or change directory
+ here.
*Syntax*
Syntax When the 'syntax' option has been set. The
pattern is matched against the syntax name.
View
4 runtime/doc/if_mzsch.txt
@@ -1,4 +1,4 @@
-*if_mzsch.txt* For Vim version 7.2. Last change: 2009 May 26
+*if_mzsch.txt* For Vim version 7.2. Last change: 2009 Jun 24
VIM REFERENCE MANUAL by Sergey Khorev
@@ -231,7 +231,7 @@ Windows *mzscheme-window*
(set-cursor (line . col) [window]) Set cursor position.
==============================================================================
-5. Dynamic loading *mzscheme-dynamic* *E812*
+5. Dynamic loading *mzscheme-dynamic* *E815*
On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version|
output then includes |+mzscheme/dyn|.
View
6 src/ex_getln.c
@@ -4874,14 +4874,14 @@ ExpandUserList(xp, num_file, file)
/* Loop over the items in the list. */
for (li = retlist->lv_first; li != NULL; li = li->li_next)
{
- if (li->li_tv.v_type != VAR_STRING)
- continue; /* Skip non-string items */
+ if (li->li_tv.v_type != VAR_STRING || li->li_tv.vval.v_string == NULL)
+ continue; /* Skip non-string items and empty strings */
if (ga_grow(&ga, 1) == FAIL)
break;
((char_u **)ga.ga_data)[ga.ga_len] =
- vim_strsave(li->li_tv.vval.v_string);
+ vim_strsave(li->li_tv.vval.v_string);
++ga.ga_len;
}
list_unref(retlist);
View
19 src/fileio.c
@@ -710,7 +710,8 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
#endif
#ifdef UNIX
/* Set swap file protection bits after creating it. */
- if (swap_mode > 0 && curbuf->b_ml.ml_mfp->mf_fname != NULL)
+ if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL
+ && curbuf->b_ml.ml_mfp->mf_fname != NULL)
(void)mch_setperm(curbuf->b_ml.ml_mfp->mf_fname, (long)swap_mode);
#endif
}
@@ -6627,7 +6628,10 @@ buf_check_timestamp(buf, focus)
mesg = _("W16: Warning: Mode of file \"%s\" has changed since editing started");
mesg2 = _("See \":help W16\" for more info.");
}
- /* Else: only timestamp changed, ignored */
+ else
+ /* Only timestamp changed, store it to avoid a warning
+ * in check_mtime() later. */
+ buf->b_mtime_read = buf->b_mtime;
}
}
}
@@ -8432,9 +8436,9 @@ aucmd_prepbuf(aco, buf)
* effects, insert it in a the current tab page.
* Anything related to a window (e.g., setting folds) may have
* unexpected results. */
- curwin = aucmd_win;
- curwin->w_buffer = buf;
+ aucmd_win->w_buffer = buf;
++buf->b_nwindows;
+ win_init_empty(aucmd_win); /* set cursor and topline to safe values */
#ifdef FEAT_WINDOWS
/* Split the current window, put the aucmd_win in the upper half. */
@@ -8445,12 +8449,7 @@ aucmd_prepbuf(aco, buf)
(void)win_comp_pos(); /* recompute window positions */
p_ea = save_ea;
#endif
- /* set cursor and topline to safe values */
- curwin_init();
-#ifdef FEAT_VERTSPLIT
- curwin->w_wincol = 0;
- curwin->w_width = Columns;
-#endif
+ curwin = aucmd_win;
}
curbuf = buf;
aco->new_curwin = curwin;
View
2  src/gui.c
@@ -959,7 +959,7 @@ gui_update_cursor(force, clear_selection)
guicolor_T fg, bg;
if (
-# ifdef HAVE_GTK2
+# if defined(HAVE_GTK2) && !defined(FEAT_HANGULIN)
preedit_get_status()
# else
im_get_status()
View
2  src/if_mzsch.c
@@ -1040,7 +1040,7 @@ mzscheme_init(void)
#ifdef DYNAMIC_MZSCHEME
if (!mzscheme_enabled(TRUE))
{
- EMSG(_("E812: Sorry, this command is disabled, the MzScheme libraries could not be loaded."));
+ EMSG(_("E815: Sorry, this command is disabled, the MzScheme libraries could not be loaded."));
return -1;
}
#endif
View
2  src/misc1.c
@@ -9193,7 +9193,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
else if (vim_strpbrk(p, (char_u *)"$~") != NULL)
{
vim_free(p);
- ga_clear(&ga);
+ ga_clear_strings(&ga);
i = mch_expand_wildcards(num_pat, pat, num_file, file,
flags);
recursive = FALSE;
View
2  src/netbeans.c
@@ -2586,7 +2586,7 @@ coloncmd(char *cmd, ...)
va_list ap;
va_start(ap, cmd);
- vsprintf(buf, cmd, ap);
+ vim_vsnprintf(buf, sizeof(buf), cmd, ap, NULL);
va_end(ap);
nbdebug((" COLONCMD %s\n", buf));
View
12 src/os_mac.h
@@ -268,9 +268,15 @@
*/
#ifdef MACOS_X_UNIX
-# define SIGPROTOARG (int)
-# define SIGDEFARG(s) (s) int s;
-# define SIGDUMMYARG 0
+# ifndef SIGPROTOARG
+# define SIGPROTOARG (int)
+# endif
+# ifndef SIGDEFARG
+# define SIGDEFARG(s) (s) int s UNUSED;
+# endif
+# ifndef SIGDUMMYARG
+# define SIGDUMMYARG 0
+# endif
# undef HAVE_AVAIL_MEM
# ifndef HAVE_CONFIG_H
# define RETSIGTYPE void
View
1  src/proto/window.pro
@@ -14,6 +14,7 @@ void win_free_all __ARGS((void));
win_T *winframe_remove __ARGS((win_T *win, int *dirp, tabpage_T *tp));
void close_others __ARGS((int message, int forceit));
void curwin_init __ARGS((void));
+void win_init_empty __ARGS((win_T *wp));
int win_alloc_first __ARGS((void));
void win_alloc_aucmd_win __ARGS((void));
void win_init_size __ARGS((void));
View
19 src/quickfix.c
@@ -3411,14 +3411,15 @@ load_dummy_buffer(fname)
/* Init the options. */
buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP);
- /* set curwin/curbuf to buf and save a few things */
- aucmd_prepbuf(&aco, newbuf);
+ /* need to open the memfile before putting the buffer in a window */
+ if (ml_open(newbuf) == OK)
+ {
+ /* set curwin/curbuf to buf and save a few things */
+ aucmd_prepbuf(&aco, newbuf);
- /* Need to set the filename for autocommands. */
- (void)setfname(curbuf, fname, NULL, FALSE);
+ /* Need to set the filename for autocommands. */
+ (void)setfname(curbuf, fname, NULL, FALSE);
- if (ml_open(curbuf) == OK)
- {
/* Create swap file now to avoid the ATTENTION message. */
check_need_swap(TRUE);
@@ -3441,10 +3442,10 @@ load_dummy_buffer(fname)
newbuf = curbuf;
}
}
- }
- /* restore curwin/curbuf and a few other things */
- aucmd_restbuf(&aco);
+ /* restore curwin/curbuf and a few other things */
+ aucmd_restbuf(&aco);
+ }
if (!buf_valid(newbuf))
return NULL;
View
8 src/testdir/Makefile
@@ -4,9 +4,11 @@
VIMPROG = ../vim
-# Uncomment this line for using valgrind.
-# The output goes into a file "valgrind.$PID" (sorry, no test number).
-# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --logfile=valgrind
+# Uncomment this line to use valgrind for memory leaks and extra warnings.
+# The output goes into a file "valgrind.testN"
+# Vim should be compiled with EXITFREE to avoid false warnings.
+# This will make testing about 10 times as slow.
+# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.$*
SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test7.out test8.out test9.out test10.out test11.out \
View
18 src/version.c
@@ -677,6 +677,24 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 218,
+/**/
+ 217,
+/**/
+ 216,
+/**/
+ 215,
+/**/
+ 214,
+/**/
+ 213,
+/**/
+ 212,
+/**/
+ 211,
+/**/
+ 210,
+/**/
209,
/**/
208,
View
62 src/window.c
@@ -2354,13 +2354,6 @@ win_free_mem(win, dirp, tp)
frame_T *frp;
win_T *wp;
-#ifdef FEAT_FOLDING
- clearFolding(win);
-#endif
-
- /* reduce the reference count to the argument list. */
- alist_unlink(win->w_alist);
-
/* Remove the window and its frame from the tree of frames. */
frp = win->w_frame;
wp = winframe_remove(win, dirp, tp);
@@ -2386,9 +2379,6 @@ win_free_all()
tabpage_close(TRUE);
# endif
- while (firstwin != NULL)
- (void)win_free_mem(firstwin, &dummy, NULL);
-
# ifdef FEAT_AUTOCMD
if (aucmd_win != NULL)
{
@@ -2396,6 +2386,9 @@ win_free_all()
aucmd_win = NULL;
}
# endif
+
+ while (firstwin != NULL)
+ (void)win_free_mem(firstwin, &dummy, NULL);
}
#endif
@@ -3204,27 +3197,34 @@ close_others(message, forceit)
void
curwin_init()
{
- redraw_win_later(curwin, NOT_VALID);
- curwin->w_lines_valid = 0;
- curwin->w_cursor.lnum = 1;
- curwin->w_curswant = curwin->w_cursor.col = 0;
+ win_init_empty(curwin);
+}
+
+ void
+win_init_empty(wp)
+ win_T *wp;
+{
+ redraw_win_later(wp, NOT_VALID);
+ wp->w_lines_valid = 0;
+ wp->w_cursor.lnum = 1;
+ wp->w_curswant = wp->w_cursor.col = 0;
#ifdef FEAT_VIRTUALEDIT
- curwin->w_cursor.coladd = 0;
+ wp->w_cursor.coladd = 0;
#endif
- curwin->w_pcmark.lnum = 1; /* pcmark not cleared but set to line 1 */
- curwin->w_pcmark.col = 0;
- curwin->w_prev_pcmark.lnum = 0;
- curwin->w_prev_pcmark.col = 0;
- curwin->w_topline = 1;
+ wp->w_pcmark.lnum = 1; /* pcmark not cleared but set to line 1 */
+ wp->w_pcmark.col = 0;
+ wp->w_prev_pcmark.lnum = 0;
+ wp->w_prev_pcmark.col = 0;
+ wp->w_topline = 1;
#ifdef FEAT_DIFF
- curwin->w_topfill = 0;
+ wp->w_topfill = 0;
#endif
- curwin->w_botline = 2;
+ wp->w_botline = 2;
#ifdef FEAT_FKMAP
- if (curwin->w_p_rl)
- curwin->w_farsi = W_CONV + W_R_L;
+ if (wp->w_p_rl)
+ wp->w_farsi = W_CONV + W_R_L;
else
- curwin->w_farsi = W_CONV;
+ wp->w_farsi = W_CONV;
#endif
}
@@ -4325,6 +4325,13 @@ win_free(wp, tp)
{
int i;
+#ifdef FEAT_FOLDING
+ clearFolding(wp);
+#endif
+
+ /* reduce the reference count to the argument list. */
+ alist_unlink(wp->w_alist);
+
#ifdef FEAT_AUTOCMD
/* Don't execute autocommands while the window is halfway being deleted.
* gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
@@ -4387,7 +4394,10 @@ win_free(wp, tp)
}
#endif /* FEAT_GUI */
- win_remove(wp, tp);
+#ifdef FEAT_AUTOCMD
+ if (wp != aucmd_win)
+#endif
+ win_remove(wp, tp);
vim_free(wp);
#ifdef FEAT_AUTOCMD
Please sign in to comment.
Something went wrong with that request. Please try again.