updated for version 7.0202
diff --git a/src/Makefile b/src/Makefile
index a4b7d20..1cdfd74 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -547,6 +547,10 @@
 #PROFILE_CFLAGS = -DEXITFREE
 #PROFILE_LIBS = -lccmalloc
 
+# MAC OS X platform
+#MAC_OSX_ARCH = -arch ppc
+MAC_OSX_ARCH = -arch i386 -arch ppc
+
 #####################################################
 ###  Specific systems, check if yours is listed!  ### {{{
 #####################################################
@@ -1197,11 +1201,11 @@
 # CARBON GUI
 CARBONGUI_SRC	= gui.c gui_mac.c
 CARBONGUI_OBJ	= objects/gui.o objects/gui_mac.o objects/pty.o
-CARBONGUI_DEFS	= -DFEAT_GUI_MAC -arch ppc -fno-common -fpascal-strings \
+CARBONGUI_DEFS	= -DFEAT_GUI_MAC $(MAC_OSX_ARCH) -fno-common -fpascal-strings \
 		  -Wall -Wno-unknown-pragmas \
 		  -mdynamic-no-pic -pipe
 CARBONGUI_IPATH	= -I. -Iproto
-CARBONGUI_LIBS_DIR =
+CARBONGUI_LIBS_DIR = $(MAC_OSX_ARCH)
 CARBONGUI_LIBS1	= -framework Carbon
 CARBONGUI_LIBS2	=
 CARBONGUI_INSTALL = install_macosx
diff --git a/src/configure.in b/src/configure.in
index 4324101..913d3e9 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -106,7 +106,7 @@
     MACOSX=yes
     OS_EXTRA_SCR="os_macosx.c os_mac_conv.c";
     OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
-    CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -I/Developer/Headers/FlatCarbon -no-cpp-precomp"
+    CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -I/Developer/Headers/FlatCarbon -no-cpp-precomp -arch i386 -arch ppc"
 
     dnl If Carbon is found, assume we don't want X11
     dnl unless it was specifically asked for (--with-x)
diff --git a/src/edit.c b/src/edit.c
index cb78cd6..b57b567 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -2845,7 +2845,7 @@
     int		c;
 
     p = compl_shown_match->cp_str;
-    if (STRLEN(p) <= len)   /* the match is too short */
+    if ((int)STRLEN(p) <= len)   /* the match is too short */
 	return;
     p += len;
 #ifdef FEAT_MBYTE
diff --git a/src/eval.c b/src/eval.c
index b0202cd..f857b8f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -621,7 +621,9 @@
 static void f_synIDattr __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_synIDtrans __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_system __ARGS((typval_T *argvars, typval_T *rettv));
+static void f_tabpagebuflist __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_tabpagenr __ARGS((typval_T *argvars, typval_T *rettv));
+static void f_tabpagewinnr __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_taglist __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_tagfiles __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_tempname __ARGS((typval_T *argvars, typval_T *rettv));
@@ -6984,7 +6986,9 @@
     {"synIDattr",	2, 3, f_synIDattr},
     {"synIDtrans",	1, 1, f_synIDtrans},
     {"system",		1, 2, f_system},
+    {"tabpagebuflist",	0, 1, f_tabpagebuflist},
     {"tabpagenr",	0, 1, f_tabpagenr},
+    {"tabpagewinnr",	1, 2, f_tabpagewinnr},
     {"tagfiles",	0, 0, f_tagfiles},
     {"taglist",		1, 1, f_taglist},
     {"tempname",	0, 0, f_tempname},
@@ -14870,6 +14874,52 @@
 }
 
 /*
+ * "tabpagebuflist()" function
+ */
+/* ARGSUSED */
+    static void
+f_tabpagebuflist(argvars, rettv)
+    typval_T	*argvars;
+    typval_T	*rettv;
+{
+#ifndef FEAT_WINDOWS
+    rettv->vval.v_number = 0;
+#else
+    tabpage_T	*tp;
+    win_T	*wp = NULL;
+    list_T	*l;
+
+    if (argvars[0].v_type == VAR_UNKNOWN)
+	wp = firstwin;
+    else
+    {
+	tp = find_tabpage((int)get_tv_number(&argvars[0]));
+	if (tp != NULL)
+	    wp = tp->tp_firstwin;
+    }
+    if (wp == NULL)
+	rettv->vval.v_number = 0;
+    else
+    {
+	l = list_alloc();
+	if (l == NULL)
+	    rettv->vval.v_number = 0;
+	else
+	{
+	    rettv->vval.v_list = l;
+	    rettv->v_type = VAR_LIST;
+	    ++l->lv_refcount;
+
+	    for (; wp != NULL; wp = wp->w_next)
+		if (list_append_number(l, wp->w_buffer->b_fnum) == FAIL)
+		    break;
+	}
+    }
+#endif
+}
+
+
+/*
  * "tabpagenr()" function
  */
 /* ARGSUSED */
@@ -14903,6 +14953,75 @@
     rettv->vval.v_number = nr;
 }
 
+
+#ifdef FEAT_WINDOWS
+static int get_winnr __ARGS((tabpage_T *tp, typval_T *argvar));
+
+/*
+ * Common code for tabpagewinnr() and winnr().
+ */
+    static int
+get_winnr(tp, argvar)
+    tabpage_T	*tp;
+    typval_T	*argvar;
+{
+    win_T	*twin;
+    int		nr = 1;
+    win_T	*wp;
+    char_u	*arg;
+
+    twin = (tp == curtab) ? curwin : tp->tp_curwin;
+    if (argvar->v_type != VAR_UNKNOWN)
+    {
+	arg = get_tv_string_chk(argvar);
+	if (arg == NULL)
+	    nr = 0;		/* type error; errmsg already given */
+	else if (STRCMP(arg, "$") == 0)
+	    twin = (tp == curtab) ? lastwin : tp->tp_lastwin;
+	else if (STRCMP(arg, "#") == 0)
+	{
+	    twin = (tp == curtab) ? prevwin : tp->tp_prevwin;
+	    if (twin == NULL)
+		nr = 0;
+	}
+	else
+	{
+	    EMSG2(_(e_invexpr2), arg);
+	    nr = 0;
+	}
+    }
+
+    if (nr > 0)
+	for (wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
+					      wp != twin; wp = wp->w_next)
+	    ++nr;
+    return nr;
+}
+#endif
+
+/*
+ * "tabpagewinnr()" function
+ */
+/* ARGSUSED */
+    static void
+f_tabpagewinnr(argvars, rettv)
+    typval_T	*argvars;
+    typval_T	*rettv;
+{
+    int		nr = 1;
+#ifdef FEAT_WINDOWS
+    tabpage_T	*tp;
+
+    tp = find_tabpage((int)get_tv_number(&argvars[0]));
+    if (tp == NULL)
+	nr = 0;
+    else
+	nr = get_winnr(tp, &argvars[1]);
+#endif
+    rettv->vval.v_number = nr;
+}
+
+
 /*
  * "tagfiles()" function
  */
@@ -15357,34 +15476,9 @@
     typval_T	*rettv;
 {
     int		nr = 1;
+
 #ifdef FEAT_WINDOWS
-    win_T	*wp;
-    win_T	*twin = curwin;
-    char_u	*arg;
-
-    if (argvars[0].v_type != VAR_UNKNOWN)
-    {
-	arg = get_tv_string_chk(&argvars[0]);
-	if (arg == NULL)
-	    nr = 0;		/* type error; errmsg already given */
-	else if (STRCMP(arg, "$") == 0)
-	    twin = lastwin;
-	else if (STRCMP(arg, "#") == 0)
-	{
-	    twin = prevwin;
-	    if (prevwin == NULL)
-		nr = 0;
-	}
-	else
-	{
-	    EMSG2(_(e_invexpr2), arg);
-	    nr = 0;
-	}
-    }
-
-    if (nr > 0)
-	for (wp = firstwin; wp != twin; wp = wp->w_next)
-	    ++nr;
+    nr = get_winnr(curtab, &argvars[0]);
 #endif
     rettv->vval.v_number = nr;
 }
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index c6cdc5a..5e4d598 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3425,7 +3425,7 @@
 	 * autocommands.  This allows for the autocommands to position the
 	 * cursor.
 	 */
-	win_init(curwin);
+	curwin_init();
 
 #ifdef FEAT_FOLDING
 	/* It's like all lines in the buffer changed.  Need to update
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index 9ab8b88..49e86a4 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -881,11 +881,11 @@
 			RANGE|NOTADR|COUNT|TRLBAR),
 EX(CMD_tabclose,	"tabclose",	ex_tabclose,
 			RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN),
-EX(CMD_tabedit,		"tabedit",	ex_tabedit,
+EX(CMD_tabedit,		"tabedit",	ex_splitview,
 			BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
-EX(CMD_tabfind,		"tabfind",	ex_tabedit,
+EX(CMD_tabfind,		"tabfind",	ex_splitview,
 			BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|NEEDARG|TRLBAR),
-EX(CMD_tabnew,		"tabnew",	ex_tabedit,
+EX(CMD_tabnew,		"tabnew",	ex_splitview,
 			BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
 EX(CMD_tabonly,		"tabonly",	ex_tabonly,
 			TRLBAR|CMDWIN),
diff --git a/src/globals.h b/src/globals.h
index 0cea5c2..23fdd66 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -495,6 +495,7 @@
 # define lastwin curwin
 # define W_NEXT(wp) NULL
 # define FOR_ALL_WINDOWS(wp) wp = curwin;
+# define FOR_ALL_TAB_WINDOWS(tp, wp) wp = curwin;
 #endif
 
 EXTERN win_T	*curwin;	/* currently active window */
diff --git a/src/hardcopy.c b/src/hardcopy.c
index 5cfeb8b..61905b0 100644
--- a/src/hardcopy.c
+++ b/src/hardcopy.c
@@ -475,6 +475,7 @@
     if (*p_header != NUL)
     {
 	linenr_T	tmp_lnum, tmp_topline, tmp_botline;
+	int		use_sandbox = FALSE;
 
 	/*
 	 * Need to (temporarily) set current line number and first/last line
@@ -490,8 +491,12 @@
 	curwin->w_botline = lnum + 63;
 	printer_page_num = pagenum;
 
+# ifdef FEAT_EVAL
+	use_sandbox = was_set_insecurely((char_u *)"printheader");
+# endif
 	build_stl_str_hl(curwin, tbuf, (size_t)(width + IOSIZE),
-						  p_header, ' ', width, NULL);
+						  p_header, use_sandbox,
+						  ' ', width, NULL);
 
 	/* Reset line numbers */
 	curwin->w_cursor.lnum = tmp_lnum;
diff --git a/src/option.c b/src/option.c
index e955f7f..601a97a 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1142,7 +1142,7 @@
 			    {(char_u *)FALSE, (char_u *)0L}},
     {"highlight",   "hl",   P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
 			    (char_u *)&p_hl, PV_NONE,
-			    {(char_u *)"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabPage,#:TabPageSel,_:TabPageFill",
+			    {(char_u *)"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill",
 				(char_u *)0L}},
     {"history",	    "hi",   P_NUM|P_VIM,
 			    (char_u *)&p_hi, PV_NONE,
@@ -2046,6 +2046,13 @@
     {"showmode",    "smd",  P_BOOL|P_VIM,
 			    (char_u *)&p_smd, PV_NONE,
 			    {(char_u *)FALSE, (char_u *)TRUE}},
+    {"showtabline", "stal", P_NUM|P_VI_DEF|P_RALL,
+#ifdef FEAT_WINDOWS
+			    (char_u *)&p_stal, PV_NONE,
+#else
+			    (char_u *)NULL, PV_NONE,
+#endif
+			    {(char_u *)1L, (char_u *)0L}},
     {"sidescroll",  "ss",   P_NUM|P_VI_DEF,
 			    (char_u *)&p_ss, PV_NONE,
 			    {(char_u *)0L, (char_u *)0L}},
@@ -2181,13 +2188,13 @@
 			    {(char_u *)0L, (char_u *)0L}
 #endif
 			    },
-    {"tabline",	    "tal",  P_NUM|P_VI_DEF|P_RALL,
-#ifdef FEAT_WINDOWS
+    {"tabline",	    "tal",  P_STRING|P_VI_DEF|P_RALL,
+#ifdef FEAT_STL_OPT
 			    (char_u *)&p_tal, PV_NONE,
 #else
 			    (char_u *)NULL, PV_NONE,
 #endif
-			    {(char_u *)1L, (char_u *)0L}},
+			    {(char_u *)"", (char_u *)0L}},
     {"tabstop",	    "ts",   P_NUM|P_VI_DEF|P_RBUF,
 			    (char_u *)&p_ts, PV_TS,
 			    {(char_u *)8L, (char_u *)0L}},
@@ -3181,8 +3188,10 @@
 								*(int *)varp;
 	}
 
-	/* the default value is not insecure */
-	options[opt_idx].flags &= ~P_INSECURE;
+	/* The default value is not insecure.  But if there are local values
+	 * we can't be sure. */
+	if (options[opt_idx].indir == PV_NONE)
+	    options[opt_idx].flags &= ~P_INSECURE;
     }
 
 #ifdef FEAT_EVAL
@@ -3351,12 +3360,12 @@
     static char_u *
 term_bg_default()
 {
-    char_u	*p;
-
 #if defined(MSDOS) || defined(OS2) || defined(WIN3264)
     /* DOS console nearly always black */
     return (char_u *)"dark";
 #else
+    char_u	*p;
+
     if (STRCMP(T_NAME, "linux") == 0
 	    || STRCMP(T_NAME, "screen.linux") == 0
 	    || STRCMP(T_NAME, "cygwin") == 0
@@ -4462,14 +4471,14 @@
 
     /* When an option is set in the sandbox, from a modeline or in secure mode
      * set the P_INSECURE flag.  Otherwise, if a new value is stored reset the
-     * flag. */
+     * flag.  But not when there are local values. */
     if (secure
 #ifdef HAVE_SANDBOX
 	    || sandbox != 0
 #endif
 	    || (opt_flags & OPT_MODELINE))
 	options[opt_idx].flags |= P_INSECURE;
-    else if (new_value)
+    else if (new_value && options[opt_idx].indir == PV_NONE)
 	options[opt_idx].flags &= ~P_INSECURE;
 }
 
@@ -7284,7 +7293,7 @@
     }
 
     /* (re)set tab page line */
-    else if (pp == &p_tal)
+    else if (pp == &p_stal)
     {
 	shell_new_rows();	/* recompute window positions and heights */
     }
diff --git a/src/option.h b/src/option.h
index d3c01ec..4dac4cc 100644
--- a/src/option.h
+++ b/src/option.h
@@ -577,7 +577,7 @@
 #endif
 #ifdef FEAT_WINDOWS
 EXTERN long	p_ls;		/* 'laststatus' */
-EXTERN long	p_tal;		/* 'tabline' */
+EXTERN long	p_stal;		/* 'showtabline' */
 #endif
 EXTERN char_u	*p_lcs;		/* 'listchars' */
 
@@ -716,6 +716,9 @@
 EXTERN int	p_sta;		/* 'smarttab' */
 #ifdef FEAT_WINDOWS
 EXTERN int	p_sb;		/* 'splitbelow' */
+# if defined(FEAT_STL_OPT)
+EXTERN char_u	*p_tal;		/* 'tabline' */
+# endif
 #endif
 #ifdef FEAT_SYN_HL
 EXTERN char_u	*p_sps;		/* 'spellsuggest' */
diff --git a/src/proto/window.pro b/src/proto/window.pro
index 7fa3572..cda7b06 100644
--- a/src/proto/window.pro
+++ b/src/proto/window.pro
@@ -11,7 +11,7 @@
 void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
 void win_free_all __ARGS((void));
 void close_others __ARGS((int message, int forceit));
-void win_init __ARGS((win_T *wp));
+void curwin_init __ARGS((void));
 int win_alloc_first __ARGS((void));
 void win_init_size __ARGS((void));
 int win_new_tabpage __ARGS((void));
diff --git a/src/quickfix.c b/src/quickfix.c
index 7243e1b..2ffce40 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2887,11 +2887,14 @@
     int		found_match;
     buf_T	*first_match_buf = NULL;
     time_t	seconds = 0;
+    int		save_mls;
 #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
     char_u	*save_ei = NULL;
-    aco_save_T	aco;
 #endif
-#ifdef FEAT_AUTOCMD
+#ifndef FEAT_AUTOCMD
+    buf_T	*save_curbuf;
+#else
+    aco_save_T	aco;
     char_u	*au_name =  NULL;
     int		flags = 0;
     colnr_T	col;
@@ -2999,11 +3002,15 @@
 	     * indent scripts, a great speed improvement. */
 	    save_ei = au_event_disable(",Filetype");
 #endif
+	    /* Don't use modelines here, it's useless. */
+	    save_mls = p_mls;
+	    p_mls = 0;
 
 	    /* Load file into a buffer, so that 'fileencoding' is detected,
 	     * autocommands applied, etc. */
 	    buf = load_dummy_buffer(fnames[fi]);
 
+	    p_mls = save_mls;
 #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
 	    au_event_restore(save_ei);
 #endif
@@ -3089,19 +3096,30 @@
 		    }
 		}
 
-#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
 		if (buf != NULL)
 		{
 		    /* The buffer is still loaded, the Filetype autocommands
-		     * need to be done now, in that buffer.  And then the
-		     * modelines need to be done (again). */
+		     * need to be done now, in that buffer.  And the modelines
+		     * need to be done (again). */
+#if defined(FEAT_AUTOCMD)
 		    aucmd_prepbuf(&aco, buf);
+#else
+		    save_curbuf = curbuf;
+		    curbuf = buf;
+		    curwin->w_buffer = curbuf;
+#endif
+#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
 		    apply_autocmds(EVENT_FILETYPE, buf->b_p_ft,
 						     buf->b_fname, TRUE, buf);
-		    do_modelines(FALSE);
-		    aucmd_restbuf(&aco);
-		}
 #endif
+		    do_modelines(FALSE);
+#if defined(FEAT_AUTOCMD)
+		    aucmd_restbuf(&aco);
+#else
+		    curbuf = save_curbuf;
+		    curwin->w_buffer = curbuf;
+#endif
+		}
 	    }
 	}
     }
diff --git a/src/screen.c b/src/screen.c
index f36ac81..d6b9b7d 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -168,7 +168,7 @@
 static void win_rest_invalid __ARGS((win_T *wp));
 static void msg_pos_mode __ARGS((void));
 #if defined(FEAT_WINDOWS)
-static void draw_tabpage __ARGS((void));
+static void draw_tabline __ARGS((void));
 #endif
 #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT)
 static int fillchar_status __ARGS((int *attr, int is_curwin));
@@ -420,7 +420,7 @@
 #ifdef FEAT_LINEBREAK
     /* Force redraw when width of 'number' column changes. */
     if (curwin->w_redr_type < NOT_VALID
-				 && curwin->w_nrwidth != number_width(curwin))
+	   && curwin->w_nrwidth != (curwin->w_p_nu ? number_width(curwin) : 0))
 	curwin->w_redr_type = NOT_VALID;
 #endif
 
@@ -477,7 +477,7 @@
 #ifdef FEAT_WINDOWS
     /* Redraw the tab pages line if needed. */
     if (redraw_tabline || type >= NOT_VALID)
-	draw_tabpage();
+	draw_tabline();
 #endif
 
     /*
@@ -707,7 +707,7 @@
 #ifdef FEAT_WINDOWS
     /* When the screen was cleared redraw the tab pages line. */
     if (redraw_tabline)
-	draw_tabpage();
+	draw_tabline();
 
     if (wp->w_redr_status
 # ifdef FEAT_CMDL_INFO
@@ -845,11 +845,11 @@
 
 #ifdef FEAT_LINEBREAK
     /* Force redraw when width of 'number' column changes. */
-    i = number_width(curwin);
-    if (curwin->w_nrwidth != i)
+    i = wp->w_p_nu ? number_width(wp) : 0;
+    if (wp->w_nrwidth != i)
     {
 	type = NOT_VALID;
-	curwin->w_nrwidth = i;
+	wp->w_nrwidth = i;
     }
     else
 #endif
@@ -4965,7 +4965,7 @@
 	if (wp->w_redr_status)
 	    win_redr_status(wp);
     if (redraw_tabline)
-	draw_tabpage();
+	draw_tabline();
 }
 #endif
 
@@ -5543,7 +5543,8 @@
 
 #if defined(FEAT_STL_OPT) || defined(PROTO)
 /*
- * Redraw the status line or ruler of window wp.
+ * Redraw the status line or ruler of window "wp".
+ * When "wp" is NULL redraw the tab pages line from 'tabline'.
  */
     static void
 win_redr_custom(wp, draw_ruler)
@@ -5562,56 +5563,88 @@
     char_u	buf[MAXPATHL];
     char_u	*p;
     struct	stl_hlrec hl[STL_MAX_ITEM];
+    int		use_sandbox = FALSE;
 
     /* setup environment for the task at hand */
-    row = W_WINROW(wp) + wp->w_height;
-    fillchar = fillchar_status(&attr, wp == curwin);
-    maxwidth = W_WIDTH(wp);
-    if (*wp->w_p_stl != NUL)
-	p = wp->w_p_stl;
-    else
-	p = p_stl;
-    if (draw_ruler)
+    if (wp == NULL)
     {
-	p = p_ruf;
-	/* advance past any leading group spec - implicit in ru_col */
-	if (*p == '%')
-	{
-	    if (*++p == '-')
-		p++;
-	    if (atoi((char *) p))
-		while (VIM_ISDIGIT(*p))
-		    p++;
-	    if (*p++ != '(')
-		p = p_ruf;
-	}
-#ifdef FEAT_VERTSPLIT
-	col = ru_col - (Columns - W_WIDTH(wp));
-	if (col < (W_WIDTH(wp) + 1) / 2)
-	    col = (W_WIDTH(wp) + 1) / 2;
-#else
-	col = ru_col;
-	if (col > (Columns + 1) / 2)
-	    col = (Columns + 1) / 2;
-#endif
-	maxwidth = W_WIDTH(wp) - col;
-#ifdef FEAT_WINDOWS
-	if (!wp->w_status_height)
-#endif
-	{
-	    row = Rows - 1;
-	    --maxwidth;	/* writing in last column may cause scrolling */
-	    fillchar = ' ';
-	    attr = 0;
-	}
+	/* Use 'tabline'.  Always at the first line of the screen. */
+	p = p_tal;
+	row = 0;
+	fillchar = t_colors < 8 ? '_' : ' ';
+	attr = hl_attr(HLF_TPF);
+	maxwidth = Columns;
+# ifdef FEAT_EVAL
+	use_sandbox = was_set_insecurely((char_u *)"tabline");
+# endif
     }
+    else
+    {
+	row = W_WINROW(wp) + wp->w_height;
+	fillchar = fillchar_status(&attr, wp == curwin);
+	maxwidth = W_WIDTH(wp);
+
+	if (draw_ruler)
+	{
+	    p = p_ruf;
+	    /* advance past any leading group spec - implicit in ru_col */
+	    if (*p == '%')
+	    {
+		if (*++p == '-')
+		    p++;
+		if (atoi((char *) p))
+		    while (VIM_ISDIGIT(*p))
+			p++;
+		if (*p++ != '(')
+		    p = p_ruf;
+	    }
+#ifdef FEAT_VERTSPLIT
+	    col = ru_col - (Columns - W_WIDTH(wp));
+	    if (col < (W_WIDTH(wp) + 1) / 2)
+		col = (W_WIDTH(wp) + 1) / 2;
+#else
+	    col = ru_col;
+	    if (col > (Columns + 1) / 2)
+		col = (Columns + 1) / 2;
+#endif
+	    maxwidth = W_WIDTH(wp) - col;
+#ifdef FEAT_WINDOWS
+	    if (!wp->w_status_height)
+#endif
+	    {
+		row = Rows - 1;
+		--maxwidth;	/* writing in last column may cause scrolling */
+		fillchar = ' ';
+		attr = 0;
+	    }
+
+# ifdef FEAT_EVAL
+	    use_sandbox = was_set_insecurely((char_u *)"rulerformat");
+# endif
+	}
+	else
+	{
+	    if (*wp->w_p_stl != NUL)
+		p = wp->w_p_stl;
+	    else
+		p = p_stl;
+# ifdef FEAT_EVAL
+	    use_sandbox = was_set_insecurely((char_u *)"statusline");
+# endif
+	}
+
+#ifdef FEAT_VERTSPLIT
+	col += W_WINCOL(wp);
+#endif
+    }
+
     if (maxwidth <= 0)
 	return;
-#ifdef FEAT_VERTSPLIT
-    col += W_WINCOL(wp);
-#endif
 
-    width = build_stl_str_hl(wp, buf, sizeof(buf), p, fillchar, maxwidth, hl);
+    width = build_stl_str_hl(wp == NULL ? curwin : wp,
+				buf, sizeof(buf),
+				p, use_sandbox,
+				fillchar, maxwidth, hl);
     len = STRLEN(buf);
 
     while (width < maxwidth && len < sizeof(buf) - 1)
@@ -6822,7 +6855,7 @@
     new_TabPageIdxs = (char_u *)lalloc((long_u)(Columns * sizeof(char_u)), FALSE);
 #endif
 
-    FOR_ALL_WINDOWS(wp)
+    FOR_ALL_TAB_WINDOWS(tp, wp)
     {
 	if (win_alloc_lines(wp) == FAIL)
 	{
@@ -8456,14 +8489,13 @@
  * Draw the tab pages line at the top of the Vim window.
  */
     static void
-draw_tabpage()
+draw_tabline()
 {
     int		tabcount = 0;
     tabpage_T	*tp;
     int		tabwidth;
     int		col = 0;
     int		scol = 0;
-    int		had_current = FALSE;
     int		attr;
     win_T	*wp;
     win_T	*cwp;
@@ -8475,12 +8507,27 @@
     int		attr_nosel = hl_attr(HLF_TP);
     int		attr_fill = hl_attr(HLF_TPF);
     char_u	*p;
+    int		room;
+    int		use_sep_chars = (t_colors < 8
+#ifdef FEAT_GUI
+					    && !gui.in_use
+#endif
+					    );
 
     redraw_tabline = FALSE;
 
     if (tabpageline_height() < 1)
 	return;
 
+#if defined(FEAT_STL_OPT)
+    /* Use the 'tabline' option if it's set. */
+    if (*p_tal != NUL)
+    {
+	win_redr_custom(NULL, FALSE);
+	return;
+    }
+#endif
+
     for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
 	++tabcount;
 
@@ -8495,17 +8542,9 @@
 	scol = col;
 
 	if (tp->tp_topframe == topframe)
-	{
-	    c = '/';
-	    had_current = TRUE;
 	    attr = attr_sel;
-	}
-	else if (!had_current)
-	    c = '/';
-	else
-	    c = '\\';
-	if (t_colors < 8)
-	    screen_putchar(c, 0, col++, attr);
+	if (use_sep_chars && col > 0)
+	    screen_putchar('|', 0, col++, attr);
 
 	if (tp->tp_topframe != topframe)
 	    attr = attr_nosel;
@@ -8531,32 +8570,49 @@
 	{
 	    if (wincount > 1)
 	    {
-		vim_snprintf((char *)NameBuff, MAXPATHL, "#%d", wincount);
+		vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount);
 		len = STRLEN(NameBuff);
-		screen_puts_len(NameBuff, len, 0, col, attr);
+		screen_puts_len(NameBuff, len, 0, col,
+#if defined(FEAT_SYN_HL)
+				       hl_combine_attr(attr, hl_attr(HLF_T))
+#else
+				       attr
+#endif
+					   );
 		col += len;
 	    }
 	    if (modified)
-		screen_puts_len((char_u *)"+", 2, 0, col++, attr);
+		screen_puts_len((char_u *)"+", 1, 0, col++, attr);
 	    screen_putchar(' ', 0, col++, attr);
 	}
 
-	if (buf_spname(cwp->w_buffer) != NULL)
-	    STRCPY(NameBuff, buf_spname(cwp->w_buffer));
-	else
-	    home_replace(cwp->w_buffer, cwp->w_buffer->b_fname, NameBuff,
+	room = scol - col + tabwidth - 1;
+	if (room > 0)
+	{
+	    if (buf_spname(cwp->w_buffer) != NULL)
+		STRCPY(NameBuff, buf_spname(cwp->w_buffer));
+	    else
+		home_replace(cwp->w_buffer, cwp->w_buffer->b_fname, NameBuff,
 							      MAXPATHL, TRUE);
-	trans_characters(NameBuff, MAXPATHL);
-	len = STRLEN(NameBuff);
-	p = NameBuff;
-	if (len > scol - col + tabwidth - 1) /* TODO: multi-byte chars */
-	{
-	    p += len - (scol - col + tabwidth - 1);
-	    len = scol - col + tabwidth - 1;
-	}
-	if (len > 0)
-	{
-	    screen_puts_len(p, len, 0, col, attr);
+	    trans_characters(NameBuff, MAXPATHL);
+	    len = vim_strsize(NameBuff);
+	    p = NameBuff;
+#ifdef FEAT_MBYTE
+	    if (has_mbyte)
+		while (len > room)
+		{
+		    len -= ptr2cells(p);
+		    mb_ptr_adv(p);
+		}
+	    else
+#endif
+		if (len > room)
+	    {
+		p += len - room;
+		len = room;
+	    }
+
+	    screen_puts_len(p, STRLEN(p), 0, col, attr);
 	    col += len;
 	}
 	screen_putchar(' ', 0, col++, attr);
@@ -8568,11 +8624,8 @@
 	    TabPageIdxs[scol++] = tabcount;
     }
 
-    if (t_colors < 8)
-    {
-	screen_putchar('\\', 0, col++, attr);
+    if (use_sep_chars)
 	c = '_';
-    }
     else
 	c = ' ';
     screen_fill(0, 1, col, (int)Columns, c, c, attr_fill);
@@ -8902,7 +8955,7 @@
 #if defined(FEAT_LINEBREAK) || defined(PROTO)
 /*
  * Return the width of the 'number' column.
- * Zero when 'number' isn't set.
+ * Caller may need to check if 'number' is set.
  * Otherwise it depends on 'numberwidth' and the line count.
  */
     int
@@ -8912,9 +8965,6 @@
     int		n;
     linenr_T	lnum;
 
-    if (!wp->w_p_nu)
-	return 0;
-
     lnum = wp->w_buffer->b_ml.ml_line_count;
     if (lnum == wp->w_nrwidth_line_count)
 	return wp->w_nrwidth_width;
diff --git a/src/structs.h b/src/structs.h
index fac1785..e5f59f2 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1578,6 +1578,7 @@
     buf_T	    *(tp_diffbuf[DB_COUNT]);
     int		    tp_diff_invalid;	/* list of diffs is outdated */
 #endif
+    frame_T	    *tp_snapshot;    /* window layout snapshot */
 };
 
 /*
diff --git a/src/syntax.c b/src/syntax.c
index 2574f3d..4560153 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -6079,8 +6079,8 @@
 	"DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red",
 	"PmenuThumb cterm=reverse gui=reverse",
 	"PmenuSbar ctermbg=Grey guibg=Grey",
-	"TabPageSel term=bold cterm=bold gui=bold",
-	"TabPageFill term=reverse cterm=reverse gui=reverse",
+	"TabLineSel term=bold cterm=bold gui=bold",
+	"TabLineFill term=reverse cterm=reverse gui=reverse",
 	NULL
     };
 
@@ -6109,7 +6109,7 @@
 	"DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue",
 	"DiffChange term=bold ctermbg=LightMagenta guibg=LightMagenta",
 	"DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan",
-	"TabPage term=underline cterm=underline ctermbg=LightGrey gui=underline guibg=LightGrey",
+	"TabLine term=underline cterm=underline ctermbg=LightGrey gui=underline guibg=LightGrey",
 	NULL
     };
 
@@ -6138,7 +6138,7 @@
 	"DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue",
 	"DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta",
 	"DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan",
-	"TabPage term=underline cterm=underline ctermbg=DarkGrey gui=underline guibg=DarkGrey",
+	"TabLine term=underline cterm=underline ctermbg=DarkGrey gui=underline guibg=DarkGrey",
 	NULL
     };
 
diff --git a/src/version.h b/src/version.h
index e09294a..9458810 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 Feb 18)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 18, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 20)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 20, compiled "