updated for version 7.0048
diff --git a/src/gui_w32.c b/src/gui_w32.c
index a29de9d..23feb6f 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -2532,6 +2532,7 @@
     int		msgheight;
     char_u	*pstart;
     char_u	*pend;
+    char_u	*last_white;
     char_u	*tbuffer;
     RECT	rect;
     HWND	hwnd;
@@ -2550,6 +2551,8 @@
     LOGFONT	lfSysmenu;
     int		use_lfSysmenu = FALSE;
 #endif
+    garray_T	ga;
+    int		l;
 
 #ifndef NO_CONSOLE
     /* Don't output anything in silent mode ("ex -s") */
@@ -2571,7 +2574,8 @@
 
     /* allocate some memory for dialog template */
     /* TODO should compute this really */
-    pdlgtemplate = p = (PWORD)LocalAlloc(LPTR, DLG_ALLOC_SIZE);
+    pdlgtemplate = p = (PWORD)LocalAlloc(LPTR,
+					    DLG_ALLOC_SIZE + STRLEN(message));
 
     if (p == NULL)
 	return -1;
@@ -2641,43 +2645,92 @@
     minButtonWidth = GetTextWidth(hdc, "Cancel", 6);
 
     /* Maximum width of a dialog, if possible */
-    GetWindowRect(s_hwnd, &rect);
-    maxDialogWidth = rect.right - rect.left
-		     - GetSystemMetrics(SM_CXFRAME) * 2;
-    if (maxDialogWidth < DLG_MIN_MAX_WIDTH)
-	maxDialogWidth = DLG_MIN_MAX_WIDTH;
+    if (s_hwnd == NULL)
+    {
+	RECT	workarea_rect;
 
-    maxDialogHeight = rect.bottom - rect.top - GetSystemMetrics(SM_CXFRAME) * 2;
-    if (maxDialogHeight < DLG_MIN_MAX_HEIGHT)
-	maxDialogHeight = DLG_MIN_MAX_HEIGHT;
+	/* We don't have a window, use the desktip area. */
+	get_work_area(&workarea_rect);
+	maxDialogWidth = workarea_rect.right - workarea_rect.left - 100;
+	if (maxDialogWidth > 600)
+	    maxDialogWidth = 600;
+	maxDialogHeight = workarea_rect.bottom - workarea_rect.top - 100;
+    }
+    else
+    {
+	/* Use our own window for the size, unless it's very small. */
+	GetWindowRect(s_hwnd, &rect);
+	maxDialogWidth = rect.right - rect.left
+					   - GetSystemMetrics(SM_CXFRAME) * 2;
+	if (maxDialogWidth < DLG_MIN_MAX_WIDTH)
+	    maxDialogWidth = DLG_MIN_MAX_WIDTH;
 
-    /* Set dlgwidth to width of message */
+	maxDialogHeight = rect.bottom - rect.top
+					   - GetSystemMetrics(SM_CXFRAME) * 2;
+	if (maxDialogHeight < DLG_MIN_MAX_HEIGHT)
+	    maxDialogHeight = DLG_MIN_MAX_HEIGHT;
+    }
+
+    /* Set dlgwidth to width of message.
+     * Copy the message into "ga", changing NL to CR-NL and inserting line
+     * breaks where needed. */
     pstart = message;
     messageWidth = 0;
-    msgheight = fontHeight;
+    msgheight = 0;
+    ga_init2(&ga, sizeof(char), 500);
     do
     {
-	pend = vim_strchr(pstart, DLG_BUTTON_SEP);
-	if (pend == NULL)
-	    pend = pstart + STRLEN(pstart);	/* Last line of message. */
-	msgheight += fontHeight;
-	textWidth = GetTextWidth(hdc, pstart, (int)(pend - pstart));
-	if (textWidth >= maxDialogWidth)
+	msgheight += fontHeight;    /* at least one line */
+
+	/* Need to figure out where to break the string.  The system does it
+	 * at a word boundary, which would mean we can't compute the number of
+	 * wrapped lines. */
+	textWidth = 0;
+	last_white = NULL;
+	for (pend = pstart; *pend != NUL && *pend != '\n'; )
 	{
-	    /* Line will wrap.  This doesn't work correctly, because the wrap
-	     * happens at a word boundary! */
-	    messageWidth = maxDialogWidth;
-	    while (textWidth >= maxDialogWidth)
+#ifdef FEAT_MBYTE
+	    l = mb_ptr2len_check(pend);
+#else
+	    l = 1;
+#endif
+	    if (l == 1 && vim_iswhite(*pend)
+					&& textWidth > maxDialogWidth * 3 / 4)
+		last_white = pend;
+	    textWidth += GetTextWidth(hdc, pend, l);
+	    if (textWidth >= maxDialogWidth)
 	    {
+		/* Line will wrap. */
+		messageWidth = maxDialogWidth;
 		msgheight += fontHeight;
-		textWidth -= maxDialogWidth;
+		textWidth = 0;
+
+		if (last_white != NULL)
+		{
+		    /* break the line just after a space */
+		    ga.ga_len -= pend - (last_white + 1);
+		    pend = last_white + 1;
+		    last_white = NULL;
+		}
+		ga_append(&ga, '\r');
+		ga_append(&ga, '\n');
+		continue;
 	    }
+
+	    while (--l >= 0)
+		ga_append(&ga, *pend++);
 	}
-	else if (textWidth > messageWidth)
+	if (textWidth > messageWidth)
 	    messageWidth = textWidth;
+
+	ga_append(&ga, '\r');
+	ga_append(&ga, '\n');
 	pstart = pend + 1;
     } while (*pend != NUL);
 
+    if (ga.ga_data != NULL)
+	message = ga.ga_data;
+
     messageWidth += 10;		/* roundoff space */
 
     /* Restrict the size to a maximum.  Causes a scrollbar to show up. */
@@ -2685,6 +2738,7 @@
     {
 	msgheight = maxDialogHeight;
 	scroll_flag = WS_VSCROLL;
+	messageWidth += GetSystemMetrics(SM_CXVSCROLL);
     }
 
     /* Add width of icon to dlgwidth, and some space */
@@ -2933,6 +2987,7 @@
     vim_free(tbuffer);
     vim_free(buttonWidths);
     vim_free(buttonPositions);
+    vim_free(ga.ga_data);
 
     /* Focus back to our window (for when MDI is used). */
     (void)SetFocus(s_hwnd);
diff --git a/src/gui_xmebw.c b/src/gui_xmebw.c
index 648eeb3..aa22a88 100644
--- a/src/gui_xmebw.c
+++ b/src/gui_xmebw.c
@@ -18,13 +18,12 @@
  */
 
 /*
- * Enhanced Motif PushButton widget with move over behaviour.
+ * Enhanced Motif PushButton widget with move over behavior.
  */
 
-#include <ctype.h>
-#include <stdio.h>
-#include <assert.h>
-#include <auto/config.h>
+#include "vim.h"
+
+#ifdef FEAT_TOOLBAR
 
 #include <Xm/XmP.h>
 #include <Xm/DrawP.h>
@@ -1407,3 +1406,5 @@
     (*(xmPushButtonClassRec.primitive_class.border_unhighlight))(w);
     draw_pixmap(eb, NULL, NULL);
 }
+
+#endif /* FEAT_TOOLBAR */
diff --git a/src/os_unix.c b/src/os_unix.c
index abfcdcc..4dd38ce 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1974,6 +1974,7 @@
 
 /*
  * Return TRUE if "name" looks like some xterm name.
+ * Seiichi Sato mentioned that "mlterm" works like xterm.
  */
     int
 vim_is_xterm(name)
@@ -1984,6 +1985,7 @@
     return (STRNICMP(name, "xterm", 5) == 0
 		|| STRNICMP(name, "nxterm", 6) == 0
 		|| STRNICMP(name, "kterm", 5) == 0
+		|| STRNICMP(name, "mlterm", 6) == 0
 		|| STRNICMP(name, "rxvt", 4) == 0
 		|| STRCMP(name, "builtin_xterm") == 0);
 }
diff --git a/src/testdir/test49.vim b/src/testdir/test49.vim
index 97db66d..46a29ff 100644
--- a/src/testdir/test49.vim
+++ b/src/testdir/test49.vim
@@ -1,6 +1,6 @@
 " Vim script language tests
 " Author:	Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
-" Last Change:	2005 Jan 18
+" Last Change:	2005 Feb 03
 
 "-------------------------------------------------------------------------------
 " Test environment							    {{{1
diff --git a/src/version.h b/src/version.h
index 5b2e7d3..187babb 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 (2005 Feb 2)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 2, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 5)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 5, compiled "