updated for version 7.0f05
diff --git a/src/getchar.c b/src/getchar.c
index 7b1cf87..3b9d420 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1033,6 +1033,38 @@
 }
 
 /*
+ * Put character "c" back into the typeahead buffer.
+ * Can be used for a character obtained by vgetc() that needs to be put back.
+ */
+    void
+ins_char_typebuf(c)
+    int	    c;
+{
+#ifdef FEAT_MBYTE
+    char_u	buf[MB_MAXBYTES];
+#else
+    char_u	buf[4];
+#endif
+    if (IS_SPECIAL(c))
+    {
+	buf[0] = K_SPECIAL;
+	buf[1] = K_SECOND(c);
+	buf[2] = K_THIRD(c);
+	buf[3] = NUL;
+    }
+    else
+    {
+#ifdef FEAT_MBYTE
+	buf[(*mb_char2bytes)(c, buf)] = NUL;
+#else
+	buf[0] = c;
+	buf[1] = NUL;
+#endif
+    }
+    (void)ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE);
+}
+
+/*
  * Return TRUE if the typeahead buffer was changed (while waiting for a
  * character to arrive).  Happens when a message was received from a client or
  * from feedkeys().
diff --git a/src/message.c b/src/message.c
index 08810ad..c67d47d 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1004,13 +1004,9 @@
 #endif
 	    if (vim_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C)
 	{
-	    char_u	buf[2];
-
 	    /* Put the character back in the typeahead buffer.  Don't use the
 	     * stuff buffer, because lmaps wouldn't work. */
-	    buf[0] = c;
-	    buf[1] = NUL;
-	    ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE);
+	    ins_char_typebuf(c);
 	    do_redraw = TRUE;	    /* need a redraw even though there is
 				       typeahead */
 	}
diff --git a/src/normal.c b/src/normal.c
index 966bb32..db6c66a 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -648,23 +648,13 @@
 	    && VIsual_select
 	    && (vim_isprintc(c) || c == NL || c == CAR || c == K_KENTER))
     {
-# ifdef FEAT_MBYTE
-	char_u	    buf[MB_MAXBYTES + 1];
-
-	buf[(*mb_char2bytes)(c, buf)] = NUL;
-# else
-	char_u	    buf[2];
-
-	buf[0] = c;
-	buf[1] = NUL;
-# endif
 	/* Fake a "c"hange command.  When "restart_edit" is set (e.g., because
 	 * 'insertmode' is set) fake a "d"elete command, Insert mode will
 	 * restart automatically.
 	 * Insert the typed character in the typeahead buffer, so that it will
 	 * be mapped in Insert mode.  Required for ":lmap" to work.  May cause
 	 * mapping a character from ":vnoremap"... */
-	(void)ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE);
+	ins_char_typebuf(c);
 	if (restart_edit != 0)
 	    c = 'd';
 	else
diff --git a/src/window.c b/src/window.c
index 8c031bf..718ce2e 100644
--- a/src/window.c
+++ b/src/window.c
@@ -47,7 +47,6 @@
 static int win_alloc_firstwin __ARGS((win_T *oldwin));
 #if defined(FEAT_WINDOWS) || defined(PROTO)
 static tabpage_T *alloc_tabpage __ARGS((void));
-static void free_tabpage __ARGS((tabpage_T *tp));
 static int leave_tabpage __ARGS((buf_T *new_curbuf));
 static void enter_tabpage __ARGS((tabpage_T *tp, buf_T *old_curbuf));
 static void frame_fix_height __ARGS((win_T *wp));
@@ -3184,7 +3183,7 @@
     return tp;
 }
 
-    static void
+    void
 free_tabpage(tp)
     tabpage_T	*tp;
 {