updated for version 7.0225
diff --git a/src/auto/configure b/src/auto/configure
index 27c2d64..13cb226 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -2838,6 +2838,10 @@
   echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 
+    if test x$prefix = xNONE; then
+    prefix=/Applications
+  fi
+
   echo "$as_me:$LINENO: checking --disable-darwin argument" >&5
 echo $ECHO_N "checking --disable-darwin argument... $ECHO_C" >&6
   # Check whether --enable-darwin or --disable-darwin was given.
diff --git a/src/configure.in b/src/configure.in
index 60a19ef..1797f69 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -85,6 +85,11 @@
 if test "`(uname) 2>/dev/null`" = Darwin; then
   AC_MSG_RESULT(yes)
 
+  dnl Default install directory is not /usr/local
+  if test x$prefix = xNONE; then
+    prefix=/Applications
+  fi
+
   AC_MSG_CHECKING(--disable-darwin argument)
   AC_ARG_ENABLE(darwin,
 	  [  --disable-darwin        Disable Darwin (Mac OS X) support.],
diff --git a/src/gui_mac.c b/src/gui_mac.c
index c4250a0..d05fddb 100644
--- a/src/gui_mac.c
+++ b/src/gui_mac.c
@@ -52,8 +52,8 @@
 static EventHandlerUPP mouseWheelHandlerUPP = NULL;
 SInt32 gMacSystemVersion;
 
-#if defined(FEAT_MBYTE)
-#define USE_CARBONKEYHANDLER
+#ifdef MACOS_CONVERT
+# define USE_CARBONKEYHANDLER
 static EventHandlerUPP keyEventHandlerUPP = NULL;
 #endif
 
@@ -130,7 +130,7 @@
     Boolean isPanelVisible;
 } gFontPanelInfo = { 0, 0, 0, false };
 
-#if defined(FEAT_MBYTE)
+#ifdef MACOS_CONVERT
 # define USE_ATSUI_DRAWING
 ATSUStyle   gFontStyle;
 Boolean	    gIsFontFallbackSet;
@@ -419,7 +419,7 @@
     return pixels;
 }
 
-#if defined(FEAT_MBYTE)
+#ifdef MACOS_CONVERT
 /*
  * Deletes all traces of any Windows-style mnemonic text (including any
  * parentheses) from a menu item and returns the cleaned menu item title.
@@ -4437,7 +4437,7 @@
 #endif
 	tempclip[scrapSize] = 0;
 
-#if defined(FEAT_MBYTE)
+#ifdef MACOS_CONVERT
 	/* Convert from utf-16 (clipboard) */
 	size_t encLen = 0;
 	char_u *to = mac_utf16_to_enc((UniChar *)tempclip, scrapSize, &encLen);
@@ -4510,7 +4510,7 @@
 
     type = clip_convert_selection(&str, (long_u *) &scrapSize, cbd);
 
-#if defined(FEAT_MBYTE)
+#ifdef MACOS_CONVERT
     size_t utf16_len = 0;
     UniChar *to = mac_enc_to_utf16(str, scrapSize, &utf16_len);
     if (to)
@@ -4628,7 +4628,7 @@
 	menu_after_me = hierMenu;
 
     /* Convert the name */
-#if defined(FEAT_MBYTE)
+#ifdef MACOS_CONVERT
     name = menu_title_removing_mnemonic(menu);
 #else
     name = C2Pascal_save(menu->dname);
@@ -4721,7 +4721,7 @@
        for older OS call GetMenuItemData (menu, item, isCommandID?, data) */
 
     /* Convert the name */
-#if defined(FEAT_MBYTE)
+#ifdef MACOS_CONVERT
     name = menu_title_removing_mnemonic(menu);
 #else
     name = C2Pascal_save(menu->dname);
@@ -5745,7 +5745,7 @@
     /* TODO: Get vim to make sure maxlen (from p_titlelen) is smaller
      *       that 256. Even better get it to fit nicely in the titlebar.
      */
-#if defined(FEAT_MBYTE)
+#ifdef MACOS_CONVERT
     CFStringRef windowTitle;
     size_t	windowTitleLen;
 #else
@@ -5755,7 +5755,7 @@
     if (title == NULL)		/* nothing to do */
 	return;
 
-#if defined(FEAT_MBYTE)
+#ifdef MACOS_CONVERT
     windowTitleLen = STRLEN(title);
     windowTitle  = mac_enc_to_cfstring(title, windowTitleLen);
 
diff --git a/src/misc2.c b/src/misc2.c
index 44b0517..dece0d9 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -964,8 +964,10 @@
 
 #ifdef FEAT_WINDOWS
     /* close all tabs and windows */
-    do_cmdline_cmd((char_u *)"tabonly!");
-    do_cmdline_cmd((char_u *)"only!");
+    if (first_tabpage->tp_next != NULL)
+	do_cmdline_cmd((char_u *)"tabonly!");
+    if (firstwin != lastwin)
+	do_cmdline_cmd((char_u *)"only!");
 #endif
 
 # if defined(FEAT_SPELL)
@@ -1077,6 +1079,10 @@
 
     reset_last_sourcing();
 
+#ifdef FEAT_WINDOWS
+    vim_free(first_tabpage);
+#endif
+
 # ifdef UNIX
     /* Machine-specific free. */
     mch_free_mem();
diff --git a/src/os_mac_conv.c b/src/os_mac_conv.c
index fbce577..9f19a80 100644
--- a/src/os_mac_conv.c
+++ b/src/os_mac_conv.c
@@ -16,7 +16,14 @@
 #define NO_X11_INCLUDES
 #include "vim.h"
 
-#ifdef FEAT_MBYTE
+#if defined(MACOS_CONVERT) || defined(PROTO)
+# ifdef PROTO
+/* A few dummy types to be able to generate function prototypes. */
+typedef int UniChar;
+typedef int *TECObjectRef;
+typedef int CFStringRef;
+# endif
+
 static char_u	    *mac_utf16_to_utf8 __ARGS((UniChar *from, size_t fromLen, size_t *actualLen));
 static UniChar	    *mac_utf8_to_utf16 __ARGS((char_u *from, size_t fromLen, size_t *actualLen));
 
@@ -477,7 +484,7 @@
 /*
  * Converts from UTF-16 UniChars to precomposed UTF-8
  */
-    char_u *
+    static char_u *
 mac_utf16_to_utf8(from, fromLen, actualLen)
     UniChar *from;
     size_t fromLen;
@@ -517,7 +524,7 @@
 /*
  * Converts from UTF-8 to UTF-16 UniChars
  */
-    UniChar *
+    static UniChar *
 mac_utf8_to_utf16(from, fromLen, actualLen)
     char_u *from;
     size_t fromLen;
@@ -548,4 +555,4 @@
 
     return result;
 }
-#endif /* FEAT_MBYTE */
+#endif /* MACOS_CONVERT */
diff --git a/src/popupmenu.c b/src/popupmenu.c
index 5126e86..ca3547c 100644
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -87,11 +87,13 @@
 	pum_height = size;
     else
 	pum_height = PUM_DEF_HEIGHT;
+    if (p_ph > 0 && pum_height > p_ph)
+	pum_height = p_ph;
 
     /* Put the pum below "row" if possible.  If there are few lines decide on
      * where there is more room. */
-    if (row >= cmdline_row - top_clear - pum_height
-	    && row > (cmdline_row - top_clear - height) / 2)
+    if (row >= cmdline_row - pum_height
+			      && row > (cmdline_row - top_clear - height) / 2)
     {
 	/* pum above "row" */
 	if (row >= size)
@@ -104,6 +106,11 @@
 	    pum_row = 0;
 	    pum_height = row;
 	}
+	if (p_ph > 0 && pum_height > p_ph)
+	{
+	    pum_row += pum_height - p_ph;
+	    pum_height = p_ph;
+	}
     }
     else
     {
@@ -113,6 +120,8 @@
 	    pum_height = cmdline_row - pum_row;
 	else
 	    pum_height = size;
+	if (p_ph > 0 && pum_height > p_ph)
+	    pum_height = p_ph;
     }
 
     /* don't display when we only have room for one line */
@@ -214,7 +223,7 @@
     int		i;
     int		idx;
     char_u	*s;
-    char_u	*p;
+    char_u	*p = NULL;
     int		totwidth, width, w;
     int		thumb_pos = 0;
     int		thumb_heigth = 1;
@@ -330,6 +339,7 @@
     int	    n;
 {
     int	    resized = FALSE;
+    int	    context = pum_height / 2;
 
     pum_selected = n;
 
@@ -364,20 +374,22 @@
 		pum_first = pum_selected - pum_height + 1;
 	}
 
-	if (pum_height > 6)
+	/* Give a few lines of context when possible. */
+	if (context > 3)
+	    context = 3;
+	if (pum_height > 2)
 	{
-	    /* Give three lines of context when possible. */
-	    if (pum_first > pum_selected - 3)
+	    if (pum_first > pum_selected - context)
 	    {
 		/* scroll down */
-		pum_first = pum_selected - 3;
+		pum_first = pum_selected - context;
 		if (pum_first < 0)
 		    pum_first = 0;
 	    }
-	    else if (pum_first < pum_selected + 3 - pum_height + 1)
+	    else if (pum_first < pum_selected + context - pum_height + 1)
 	    {
 		/* scroll up */
-		pum_first = pum_selected + 3 - pum_height + 1;
+		pum_first = pum_selected + context - pum_height + 1;
 	    }
 	}
 
@@ -479,6 +491,12 @@
 
 			if (win_valid(curwin_save))
 			    win_enter(curwin_save, TRUE);
+
+			/* May need to update the screen again when there are
+			 * autocommands involved. */
+			pum_do_redraw = TRUE;
+			update_screen(0);
+			pum_do_redraw = FALSE;
 		    }
 		}
 	    }
diff --git a/src/screen.c b/src/screen.c
index 64c2bb5..6de791d 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -7305,6 +7305,11 @@
 #endif
 
     entered = FALSE;
+
+#ifdef FEAT_AUTOCMD
+    if (starting == 0)
+	apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
+#endif
 }
 
     void
diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak
index 62e3ded..3bbd964 100644
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -24,7 +24,8 @@
 		test38.out test39.out test40.out test41.out test42.out \
 		test43.out test44.out test45.out test46.out test47.out \
 		test48.out test51.out test53.out test54.out test55.out \
-		test56.out test57.out test58.out test59.out test60.out
+		test56.out test57.out test58.out test59.out test60.out \
+		test61.out
 
 .SUFFIXES: .in .out
 
@@ -104,3 +105,4 @@
 test58.out: test58.in
 test59.out: test59.in
 test60.out: test60.in
+test61.out: test61.in
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index cbab6cd..66c9f9f 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -19,7 +19,7 @@
 		test44.out test45.out test46.out test47.out \
 		test48.out test51.out test53.out test54.out \
 		test55.out test56.out test57.out test58.out test59.out \
-		test60.out
+		test60.out test61.out
 
 SCRIPTS =	test3.out test4.out test5.out test6.out test7.out \
 		test8.out test9.out test11.out test13.out test14.out \
diff --git a/src/undo.c b/src/undo.c
index 88f11a3..27f04b9 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -295,6 +295,8 @@
 	    if (uhp == NULL)
 		goto nomem;
 	}
+	else
+	    uhp = NULL;
 
 	/*
 	 * If we undid more than we redid, move the entry lists before and
@@ -326,7 +328,7 @@
 	    }
 	}
 
-	if (p_ul < 0)		/* no undo at all */
+	if (uhp == NULL)		/* no undo at all */
 	{
 	    if (old_curhead != NULL)
 		u_freebranch(curbuf, old_curhead, NULL);
@@ -655,6 +657,10 @@
     int		    dosec = sec;
     int		    above = FALSE;
 
+    /* First make sure the current undoable change is synced. */
+    if (curbuf->b_u_synced == FALSE)
+	u_sync();
+
     u_newcount = 0;
     u_oldcount = 0;
     if (curbuf->b_ml.ml_flags & ML_EMPTY)
diff --git a/src/version.h b/src/version.h
index d239d8a..774222d 100644
--- a/src/version.h
+++ b/src/version.h
@@ -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 Mar 14)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 14, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 15)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2006 Mar 15, compiled "