updated for version 7.0d01
diff --git a/src/Make_vms.mms b/src/Make_vms.mms
index 557cb6d..895b7bc 100644
--- a/src/Make_vms.mms
+++ b/src/Make_vms.mms
@@ -2,7 +2,7 @@
 # Makefile for Vim on OpenVMS
 #
 # Maintainer:   Zoltan Arpadffy <arpadffy@polarhome.com>
-# Last change:  2006 Mar 31
+# Last change:  2006 Apr 11
 #
 # This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64
 # with MMS and MMK
@@ -44,6 +44,7 @@
 
 # GUI or terminal mode executable.
 # Comment out if you want just the character terminal mode only.
+# GUI with Motif
 GUI = YES
 
 # GUI with GTK
@@ -136,12 +137,24 @@
 
 CONFIG_H = os_vms_conf.h
 
+# GTK or XPM but not both
 .IFDEF GTK
 .IFDEF GUI
-.IFDEF XPM
 .ELSE
 GUI = YES
 .ENDIF
+.IFDEF XPM
+XPM = ""
+.ENDIF
+.ENDIF
+
+.IFDEF XPM
+.IFDEF GUI
+.ELSE
+GUI = YES
+.ENDIF
+.IFDEF GTK
+GTK = ""
 .ENDIF
 .ENDIF
 
diff --git a/src/dosinst.h b/src/dosinst.h
index 485e7cd..455d2a6 100644
--- a/src/dosinst.h
+++ b/src/dosinst.h
@@ -207,6 +207,14 @@
 }
 
 #ifdef WIN3264
+
+#ifndef CSIDL_COMMON_PROGRAMS
+# define CSIDL_COMMON_PROGRAMS 0x0017
+#endif
+#ifndef CSIDL_COMMON_DESKTOPDIRECTORY
+# define CSIDL_COMMON_DESKTOPDIRECTORY 0x0019
+#endif
+
 /*
  * Get the path to a requested Windows shell folder.
  *
@@ -234,22 +242,14 @@
     if (strcmp(shell_folder_name, "desktop") == 0)
     {
 	pcsidl = &desktop_csidl;
-#ifdef CSIDL_COMMON_DESKTOPDIRECTORY
 	csidl = CSIDL_COMMON_DESKTOPDIRECTORY;
 	alt_csidl = CSIDL_DESKTOP;
-#else
-	csidl = CSIDL_DESKTOP;
-#endif
     }
     else if (strncmp(shell_folder_name, "Programs", 8) == 0)
     {
 	pcsidl = &programs_csidl;
-#ifdef CSIDL_COMMON_PROGRAMS
 	csidl = CSIDL_COMMON_PROGRAMS;
 	alt_csidl = CSIDL_PROGRAMS;
-#else
-	csidl = CSIDL_PROGRAMS;
-#endif
     }
     else
     {
diff --git a/src/edit.c b/src/edit.c
index 08a24d7..f2a5cda 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -2969,6 +2969,9 @@
 	    ins_compl_set_original_text(compl_leader);
 	else
 	{
+#ifdef FEAT_SPELL
+	    spell_bad_len = 0;	/* need to redetect bad word */
+#endif
 	    /* Matches were cleared, need to search for them now. */
 	    if (ins_complete(Ctrl_N) == FAIL)
 		compl_cont_status = 0;
diff --git a/src/eval.c b/src/eval.c
index 1b75201..45efab7 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -16208,7 +16208,7 @@
 	    return NULL;
 	len = (long)STRLEN(ml_get(pos.lnum));
 	/* Accept a position up to the NUL after the line. */
-	if (pos.col <= 0 || (int)pos.col > len + 1)
+	if (pos.col == 0 || (int)pos.col > len + 1)
 	    return NULL;	/* invalid column number */
 	--pos.col;
 
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 9206e02..9ba3e81 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -261,18 +261,23 @@
     return len;
 }
 
-/* Buffer for one line used during sorting.  It's allocated to contain the
- * longest line being sorted. */
-static char_u	*sortbuf;
+/* Buffer for two lines used during sorting.  They are allocated to
+ * contain the longest line being sorted. */
+static char_u	*sortbuf1;
+static char_u	*sortbuf2;
 
 static int	sort_ic;		/* ignore case */
 static int	sort_nr;		/* sort on number */
+static int	sort_rx;		/* sort on regex instead of skipping it */
+
+static int	sort_abort;		/* flag to indicate if sorting has been interrupted */
 
 /* Struct to store info to be sorted. */
 typedef struct
 {
     linenr_T	lnum;			/* line number */
-    long	col_nr;			/* column number or number */
+    long	start_col_nr;		/* starting column number or number */
+    long	end_col_nr;		/* ending column number */
 } sorti_T;
 
 static int
@@ -291,18 +296,35 @@
 {
     sorti_T	l1 = *(sorti_T *)s1;
     sorti_T	l2 = *(sorti_T *)s2;
-    char_u	*s;
+    int		result = 0;
 
-    /* When sorting numbers "col_nr" is the number, not the column number. */
+    /* If the user interrupts, there's no way to stop qsort() immediately, but
+     * if we return 0 every time, qsort will assume it's done sorting and exit */
+    if (sort_abort)
+	return 0;
+    fast_breakcheck();
+    if (got_int)
+	sort_abort = TRUE;
+
+    /* When sorting numbers "start_col_nr" is the number, not the column number. */
     if (sort_nr)
-	return l1.col_nr - l2.col_nr;
+	result = l1.start_col_nr - l2.start_col_nr;
+    else
+    {
+	/* We need to copy one line into "sortbuf1", because there is no guarantee
+	 * that the first pointer becomes invalid when obtaining the second one. */
+	STRNCPY(sortbuf1, ml_get(l1.lnum) + l1.start_col_nr, l1.end_col_nr - l1.start_col_nr + 1);
+	sortbuf1[l1.end_col_nr - l1.start_col_nr] = 0;
+	STRNCPY(sortbuf2, ml_get(l2.lnum) + l2.start_col_nr, l2.end_col_nr - l2.start_col_nr + 1);
+	sortbuf2[l2.end_col_nr - l2.start_col_nr] = 0;
 
-    /* We need to copy one line into "sortbuf", because there is no guarantee
-     * that the first pointer becomes invalid when obtaining the second one. */
-    STRCPY(sortbuf, ml_get(l1.lnum) + l1.col_nr);
-    s = ml_get(l2.lnum) + l2.col_nr;
-
-    return sort_ic ? STRICMP(sortbuf, s) : STRCMP(sortbuf, s);
+	result = sort_ic ? STRICMP(sortbuf1, sortbuf2) : STRCMP(sortbuf1, sortbuf2);
+    }
+    /* If the two lines have the same value, preserve the original line order */
+    if (result == 0)
+	return (int) (l1.lnum - l2.lnum);
+    else
+	return result;
 }
 
 /*
@@ -321,21 +343,25 @@
     size_t	i;
     char_u	*p;
     char_u	*s;
+    char_u	*s2;
+    char_u	c;			/* temporary character storage */
     int		unique = FALSE;
     long	deleted;
-    colnr_T	col;
+    colnr_T	start_col;
+    colnr_T	end_col;
     int		sort_oct;		/* sort on octal number */
     int		sort_hex;		/* sort on hex number */
 
     if (u_save((linenr_T)(eap->line1 - 1), (linenr_T)(eap->line2 + 1)) == FAIL)
 	return;
-    sortbuf = NULL;
+    sortbuf1 = NULL;
+    sortbuf2 = NULL;
     regmatch.regprog = NULL;
     nrs = (sorti_T *)lalloc((long_u)(count * sizeof(sorti_T)), TRUE);
     if (nrs == NULL)
-	goto theend;
+	goto sortend;
 
-    sort_ic = sort_nr = sort_oct = sort_hex = 0;
+    sort_abort = sort_ic = sort_rx = sort_nr = sort_oct = sort_hex = 0;
 
     for (p = eap->arg; *p != NUL; ++p)
     {
@@ -343,6 +369,8 @@
 	    ;
 	else if (*p == 'i')
 	    sort_ic = TRUE;
+	else if (*p == 'r')
+	    sort_rx = TRUE;
 	else if (*p == 'n')
 	    sort_nr = 2;
 	else if (*p == 'o')
@@ -364,19 +392,19 @@
 	    if (*s != *p)
 	    {
 		EMSG(_(e_invalpat));
-		goto theend;
+		goto sortend;
 	    }
 	    *s = NUL;
 	    regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC);
 	    if (regmatch.regprog == NULL)
-		goto theend;
+		goto sortend;
 	    p = s;		/* continue after the regexp */
 	    regmatch.rm_ic = p_ic;
 	}
 	else
 	{
 	    EMSG2(_(e_invarg2), p);
-	    goto theend;
+	    goto sortend;
 	}
     }
 
@@ -384,7 +412,7 @@
     if (sort_nr + sort_oct + sort_hex > 2)
     {
 	EMSG(_(e_invarg));
-	goto theend;
+	goto sortend;
     }
 
     /* From here on "sort_nr" is used as a flag for any number sorting. */
@@ -393,9 +421,9 @@
     /*
      * Make an array with all line numbers.  This avoids having to copy all
      * the lines into allocated memory.
-     * When sorting on strings "col_nr" is de offset in the line, for numbers
-     * sorting it's the number to sort on.  This means the pattern matching
-     * and number conversion only has to be done once per line.
+     * When sorting on strings "start_col_nr" is the offset in the line, for
+     * numbers sorting it's the number to sort on.  This means the pattern
+     * matching and number conversion only has to be done once per line.
      * Also get the longest line length for allocating "sortbuf".
      */
     for (lnum = eap->line1; lnum <= eap->line2; ++lnum)
@@ -405,57 +433,83 @@
 	if (maxlen < len)
 	    maxlen = len;
 
+	start_col = 0;
+	end_col = len;
 	if (regmatch.regprog != NULL && vim_regexec(&regmatch, s, 0))
-	    col = regmatch.endp[0] - s;
+	{
+	    if (sort_rx)
+	    {
+		start_col = regmatch.startp[0] - s;
+		end_col = regmatch.endp[0] - s;
+	    }
+	    else
+		start_col = regmatch.endp[0] - s;
+	}
 	else
-	    col = 0;
+	    if (regmatch.regprog != NULL)
+		end_col = 0;
 
 	if (sort_nr)
 	{
+	    /* Make sure vim_str2nr doesn't read any digits past the end
+	     * of the match, by temporarily terminating the string there */
+	    s2 = s + end_col;
+	    c = *s2;
+	    (*s2) = 0;
 	    /* Sorting on number: Store the number itself. */
 	    if (sort_hex)
-		s = skiptohex(s + col);
+		s = skiptohex(s + start_col);
 	    else
-		s = skiptodigit(s + col);
+		s = skiptodigit(s + start_col);
 	    vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
-					&nrs[lnum - eap->line1].col_nr, NULL);
+					&nrs[lnum - eap->line1].start_col_nr, NULL);
+	    (*s2) = c;
 	}
 	else
+	{
 	    /* Store the column to sort at. */
-	    nrs[lnum - eap->line1].col_nr = col;
+	    nrs[lnum - eap->line1].start_col_nr = start_col;
+	    nrs[lnum - eap->line1].end_col_nr = end_col;
+	}
 
 	nrs[lnum - eap->line1].lnum = lnum;
 
 	if (regmatch.regprog != NULL)
 	    fast_breakcheck();
 	if (got_int)
-	    goto theend;
+	    goto sortend;
     }
 
     /* Allocate a buffer that can hold the longest line. */
-    sortbuf = alloc((unsigned)maxlen + 1);
-    if (sortbuf == NULL)
-	goto theend;
+    sortbuf1 = alloc((unsigned)maxlen + 1);
+    if (sortbuf1 == NULL)
+	goto sortend;
+    sortbuf2 = alloc((unsigned)maxlen + 1);
+    if (sortbuf2 == NULL)
+	goto sortend;
 
     /* Sort the array of line numbers.  Note: can't be interrupted! */
     qsort((void *)nrs, count, sizeof(sorti_T), sort_compare);
 
+    if (sort_abort)
+	goto sortend;
+
     /* Insert the lines in the sorted order below the last one. */
     lnum = eap->line2;
     for (i = 0; i < count; ++i)
     {
 	s = ml_get(nrs[eap->forceit ? count - i - 1 : i].lnum);
 	if (!unique || i == 0
-		|| (sort_ic ? STRICMP(s, sortbuf) : STRCMP(s, sortbuf)) != 0)
+		|| (sort_ic ? STRICMP(s, sortbuf1) : STRCMP(s, sortbuf1)) != 0)
 	{
 	    if (ml_append(lnum++, s, (colnr_T)0, FALSE) == FAIL)
 		break;
 	    if (unique)
-		STRCPY(sortbuf, s);
+		STRCPY(sortbuf1, s);
 	}
 	fast_breakcheck();
 	if (got_int)
-	    goto theend;
+	    goto sortend;
     }
 
     /* delete the original lines if appending worked */
@@ -476,9 +530,10 @@
     curwin->w_cursor.lnum = eap->line1;
     beginline(BL_WHITE | BL_FIX);
 
-theend:
+sortend:
     vim_free(nrs);
-    vim_free(sortbuf);
+    vim_free(sortbuf1);
+    vim_free(sortbuf2);
     vim_free(regmatch.regprog);
     if (got_int)
 	EMSG(_(e_interr));
diff --git a/src/option.c b/src/option.c
index 0a4d9c7..d24b2cd 100644
--- a/src/option.c
+++ b/src/option.c
@@ -10252,7 +10252,7 @@
     char_u	*envname;
 {
     int		opt_idx;
-    int		dofree;
+    int		dofree = FALSE;
     char_u	*p;
 
     if (!option_was_set((char_u *)"cp"))
diff --git a/src/os_mac_rsrc/doc-txt.icns b/src/os_mac_rsrc/doc-txt.icns
index 124a730..2219e2c 100644
--- a/src/os_mac_rsrc/doc-txt.icns
+++ b/src/os_mac_rsrc/doc-txt.icns
Binary files differ
diff --git a/src/screen.c b/src/screen.c
index b82bd98..d371ed9 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -231,7 +231,15 @@
 redraw_later_clear()
 {
     redraw_all_later(CLEAR);
-    screen_attr = HL_BOLD | HL_UNDERLINE;
+#ifdef FEAT_GUI
+    if (gui.in_use)
+	/* Use a code that will reset gui.highlight_mask in
+	 * gui_stop_highlight(). */
+	screen_attr = HL_ALL + 1;
+    else
+#endif
+	/* Use attributes that is very unlikely to appear in text. */
+	screen_attr = HL_BOLD | HL_UNDERLINE | HL_INVERSE;
 }
 
 /*
diff --git a/src/testdir/test57.in b/src/testdir/test57.in
index 7e70169..d74af57 100644
--- a/src/testdir/test57.in
+++ b/src/testdir/test57.in
@@ -3,50 +3,494 @@
 STARTTEST
 :so small.vim
 :"
-:/^t1:/+1,/^t2/-1sort
-:/^t2:/+1,/^t3/-1sort u
-:/^t3:/+1,/^t4/-1sort u /[^:]*:/
-:/^t4:/+1,/^t5/-1sort n
-:/^t5:/+1,/^t6/-1sort n -[^:]*:-
-:/^t6:/+1,/^t7/-1sort o
-:/^t7:/+1,/^t8/-1sort x ,.*/,
-:/^t8:/+1,/^t9/-1sort n o
-:/^t1:/,$wq! test.out
+:/^t01:/+1,/^t02/-1sort
+:/^t02:/+1,/^t03/-1sort n
+:/^t03:/+1,/^t04/-1sort x
+:/^t04:/+1,/^t05/-1sort u
+:/^t05:/+1,/^t06/-1sort!
+:/^t06:/+1,/^t07/-1sort! n        
+:/^t07:/+1,/^t08/-1sort! u
+:/^t08:/+1,/^t09/-1sort o         
+:/^t09:/+1,/^t10/-1sort! x        
+:/^t10:/+1,/^t11/-1sort/./        
+:/^t11:/+1,/^t12/-1sort/../       
+:/^t12:/+1,/^t13/-1sort/../u
+:/^t13:/+1,/^t14/-1sort/./n
+:/^t14:/+1,/^t15/-1sort/./r
+:/^t15:/+1,/^t16/-1sort/../r
+:/^t16:/+1,/^t17/-1sort/./rn
+:/^t17:/+1,/^t18/-1sort/\d/
+:/^t18:/+1,/^t19/-1sort/\d/r
+:/^t19:/+1,/^t20/-1sort/\d/n
+:/^t20:/+1,/^t21/-1sort/\d/rn
+:/^t21:/+1,/^t22/-1sort/\d\d/
+:/^t22:/+1,/^t23/-1sort/\d\d/n
+:/^t23:/+1,/^t24/-1sort/\d\d/x
+:/^t24:/+1,/^t25/-1sort/\d\d/r
+:/^t25:/+1,/^t26/-1sort/\d\d/rn
+:/^t26:/+1,/^t27/-1sort/\d\d/rx
+:/^t27:/+1,/^t28/-1sort no
+:/^t01:/,$wq! test.out
 ENDTEST
 
-t1: alphabetical
-two test
-One test
-one test
-Two test
-t2: alpha, unique
-One test
-one test
-Two test
-one test
-Two test 
-t3: alpha, unique, skip pattern
-one: xay
-two: aaa
-another: tuvy
-t4: number
-asdf 83 asd
-one 333   
-xce   9
-t5: number and skip
-asdf 3 a: sd 11
-one 33:4   99
-:9 
-t6: octal
-2389
-111
-asdf 0014
-t7: hex and skip
-sf/0x1d3
-0x44/1a1
-asd/ad 1413
-t8: wrong arguments
-ccc
-bbb
-aaa
-t8:
+t01: alphebetical
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t02: numeric
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t03: hexadecimal
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t04: alpha, unique
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t05: alpha, reverse
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t06: numeric, reverse
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t07: unique, reverse
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t08: octal
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t09: reverse, hexadecimal
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t10: alpha, skip first character
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t11: alpha, skip first 2 characters
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t12: alpha, unique, skip first 2 characters
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t13: numeric, skip first character
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t14: alpha, sort on first character
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t15: alpha, sort on first 2 characters
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t16: numeric, sort on first character
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t17: alpha, skip past first digit
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t18: alpha, sort on first digit
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t19: numeric, skip past first digit
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t20: numeric, sort on first digit
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t21: alpha, skip past first 2 digits
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t22: numeric, skip past first 2 digits
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t23: hexadecimal, skip past first 2 digits
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t24: alpha, sort on first 2 digits
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t25: numeric, sort on first 2 digits
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t26: hexadecimal, sort on first 2 digits
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t27: wrong arguments
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t28: done
+
diff --git a/src/testdir/test57.ok b/src/testdir/test57.ok
index 69b9862..1777133 100644
--- a/src/testdir/test57.ok
+++ b/src/testdir/test57.ok
@@ -1,35 +1,455 @@
-t1: alphabetical
-One test
-Two test
-one test
-two test
-t2: alpha, unique
-One test
-Two test
-Two test 
-one test
-t3: alpha, unique, skip pattern
-two: aaa
-another: tuvy
-one: xay
-t4: number
-xce   9
-asdf 83 asd
-one 333   
-t5: number and skip
-one 33:4   99
-:9 
-asdf 3 a: sd 11
-t6: octal
-asdf 0014
-2389
-111
-t7: hex and skip
-asd/ad 1413
-0x44/1a1
-sf/0x1d3
-t8: wrong arguments
-ccc
-bbb
-aaa
-t8:
+t01: alphebetical
+
+
+ 123b
+a
+a122
+a123
+a321
+ab
+abc
+b123
+b321
+b321
+b321b
+b322b
+c123d
+c321d
+t02: numeric
+abc
+ab
+a
+
+
+a122
+a123
+b123
+c123d
+ 123b
+a321
+b321
+c321d
+b321
+b321b
+b322b
+t03: hexadecimal
+
+
+a
+ab
+abc
+ 123b
+a122
+a123
+a321
+b123
+b321
+b321
+b321b
+b322b
+c123d
+c321d
+t04: alpha, unique
+
+ 123b
+a
+a122
+a123
+a321
+ab
+abc
+b123
+b321
+b321b
+b322b
+c123d
+c321d
+t05: alpha, reverse
+c321d
+c123d
+b322b
+b321b
+b321
+b321
+b123
+abc
+ab
+a321
+a123
+a122
+a
+ 123b
+
+
+t06: numeric, reverse
+b322b
+b321b
+b321
+c321d
+b321
+a321
+ 123b
+c123d
+b123
+a123
+a122
+
+
+a
+ab
+abc
+t07: unique, reverse
+c321d
+c123d
+b322b
+b321b
+b321
+b123
+abc
+ab
+a321
+a123
+a122
+a
+ 123b
+
+t08: octal
+abc
+ab
+a
+
+
+a122
+a123
+b123
+c123d
+ 123b
+a321
+b321
+c321d
+b321
+b321b
+b322b
+t09: reverse, hexadecimal
+c321d
+c123d
+b322b
+b321b
+b321
+b321
+b123
+a321
+a123
+a122
+ 123b
+abc
+ab
+a
+
+
+t10: alpha, skip first character
+a
+
+
+a122
+a123
+b123
+ 123b
+c123d
+a321
+b321
+b321
+b321b
+c321d
+b322b
+ab
+abc
+t11: alpha, skip first 2 characters
+ab
+a
+
+
+a321
+b321
+b321
+b321b
+c321d
+a122
+b322b
+a123
+b123
+ 123b
+c123d
+abc
+t12: alpha, unique, skip first 2 characters
+ab
+a
+
+a321
+b321
+b321b
+c321d
+a122
+b322b
+a123
+b123
+ 123b
+c123d
+abc
+t13: numeric, skip first character
+abc
+ab
+a
+
+
+a122
+a123
+b123
+c123d
+ 123b
+a321
+b321
+c321d
+b321
+b321b
+b322b
+t14: alpha, sort on first character
+
+
+ 123b
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+b322b
+b321
+b321b
+c123d
+c321d
+t15: alpha, sort on first 2 characters
+a
+
+
+ 123b
+a123
+a122
+a321
+abc
+ab
+b123
+b321
+b322b
+b321
+b321b
+c123d
+c321d
+t16: numeric, sort on first character
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t17: alpha, skip past first digit
+abc
+ab
+a
+
+
+a321
+b321
+b321
+b321b
+c321d
+a122
+b322b
+a123
+b123
+ 123b
+c123d
+t18: alpha, sort on first digit
+abc
+ab
+a
+
+
+a123
+a122
+b123
+c123d
+ 123b
+a321
+b321
+c321d
+b322b
+b321
+b321b
+t19: numeric, skip past first digit
+abc
+ab
+a
+
+
+a321
+b321
+c321d
+b321
+b321b
+a122
+b322b
+a123
+b123
+c123d
+ 123b
+t20: numeric, sort on first digit
+abc
+ab
+a
+
+
+a123
+a122
+b123
+c123d
+ 123b
+a321
+b321
+c321d
+b322b
+b321
+b321b
+t21: alpha, skip past first 2 digits
+abc
+ab
+a
+
+
+a321
+b321
+b321
+b321b
+c321d
+a122
+b322b
+a123
+b123
+ 123b
+c123d
+t22: numeric, skip past first 2 digits
+abc
+ab
+a
+
+
+a321
+b321
+c321d
+b321
+b321b
+a122
+b322b
+a123
+b123
+c123d
+ 123b
+t23: hexadecimal, skip past first 2 digits
+abc
+ab
+a
+
+
+a321
+b321
+b321
+a122
+a123
+b123
+b321b
+c321d
+b322b
+ 123b
+c123d
+t24: alpha, sort on first 2 digits
+abc
+ab
+a
+
+
+a123
+a122
+b123
+c123d
+ 123b
+a321
+b321
+c321d
+b322b
+b321
+b321b
+t25: numeric, sort on first 2 digits
+abc
+ab
+a
+
+
+a123
+a122
+b123
+c123d
+ 123b
+a321
+b321
+c321d
+b322b
+b321
+b321b
+t26: hexadecimal, sort on first 2 digits
+abc
+ab
+a
+
+
+a123
+a122
+b123
+c123d
+ 123b
+a321
+b321
+c321d
+b322b
+b321
+b321b
+t27: wrong arguments
+abc
+ab
+a
+a321
+a123
+a122
+b321
+b123
+c123d
+ 123b
+c321d
+b322b
+b321
+b321b
+
+
+t28: done
+
diff --git a/src/version.h b/src/version.h
index 9358164..4b7c05a 100644
--- a/src/version.h
+++ b/src/version.h
@@ -35,6 +35,6 @@
  */
 #define VIM_VERSION_NODOT	"vim70d"
 #define VIM_VERSION_SHORT	"7.0d"
-#define VIM_VERSION_MEDIUM	"7.0d BETA"
-#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0d BETA (2006 Apr 10)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0d BETA (2006 Apr 10, compiled "
+#define VIM_VERSION_MEDIUM	"7.0d01 BETA"
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0d01 BETA (2006 Apr 11)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0d01 BETA (2006 Apr 11, compiled "
diff --git a/src/window.c b/src/window.c
index b401fc1..5ee8172 100644
--- a/src/window.c
+++ b/src/window.c
@@ -91,6 +91,9 @@
 #endif
 
 #if defined(FEAT_WINDOWS) || defined(PROTO)
+
+static char *m_onlyone = N_("Already only one window");
+
 /*
  * all CTRL-W window commands are handled here, called from normal_cmd().
  */
@@ -330,6 +333,31 @@
 		break;
 #endif
 
+/* move window to new tab page */
+    case 'T':
+		if (firstwin == lastwin)
+		    MSG(_(m_onlyone));
+		else
+		{
+		    tabpage_T	*oldtab = curtab;
+		    tabpage_T	*newtab;
+		    win_T	*wp = curwin;
+
+		    /* First create a new tab with the window, then go back to
+		     * the old tab and close the window there. */
+		    if (win_new_tabpage((int)Prenum) == OK
+						     && valid_tabpage(oldtab))
+		    {
+			newtab = curtab;
+			goto_tabpage_tp(oldtab);
+			if (curwin == wp)
+			    win_close(curwin, FALSE);
+			if (valid_tabpage(newtab))
+			    goto_tabpage_tp(newtab);
+		    }
+		}
+		break;
+
 /* cursor to top-left window */
     case 't':
     case Ctrl_T:
@@ -1102,6 +1130,7 @@
     newp->w_pcmark = oldp->w_pcmark;
     newp->w_prev_pcmark = oldp->w_prev_pcmark;
     newp->w_alt_fnum = oldp->w_alt_fnum;
+    newp->w_wrow = oldp->w_wrow;
     newp->w_fraction = oldp->w_fraction;
     newp->w_prev_fraction_row = oldp->w_prev_fraction_row;
 #ifdef FEAT_JUMPLIST
@@ -2938,7 +2967,7 @@
 		    && !autocmd_busy
 #endif
 				    )
-	    MSG(_("Already only one window"));
+	    MSG(_(m_onlyone));
 	return;
     }
 
@@ -5153,6 +5182,8 @@
      * Will equalize heights soon to fix it. */
     if (height < 0)
 	height = 0;
+    if (wp->w_height == height)
+	return;	    /* nothing to do */
 
     if (wp->w_wrow != wp->w_prev_fraction_row && wp->w_height > 0)
 	wp->w_fraction = ((long)wp->w_wrow * FRACTION_MULT