diff src/ex_docmd.c @ 10383:b59df2194b01 v8.0.0086

commit https://github.com/vim/vim/commit/2256c9947164229c0960803e2a2992b793c23298 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 15 21:17:07 2016 +0100 patch 8.0.0086 Problem: Cannot add a comment after ":hide". (Norio Takagi) Solution: Make it work, add a test. (Hirohito Higashi)
author Christian Brabandt <cb@256bit.org>
date Tue, 15 Nov 2016 21:30:04 +0100
parents bd674706408a
children dc9326b58c33
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -5632,15 +5632,16 @@ find_nextcmd(char_u *p)
 #endif
 
 /*
- * Check if *p is a separator between Ex commands.
- * Return NULL if it isn't, (p + 1) if it is.
+ * Check if *p is a separator between Ex commands, skipping over white space.
+ * Return NULL if it isn't, the following character if it is.
  */
     char_u *
 check_nextcmd(char_u *p)
 {
-    p = skipwhite(p);
-    if (*p == '|' || *p == '\n')
-	return (p + 1);
+    char_u *s = skipwhite(p);
+
+    if (*s == '|' || *s == '\n')
+	return (s + 1);
     else
 	return NULL;
 }
@@ -7572,38 +7573,32 @@ ex_all(exarg_T *eap)
     static void
 ex_hide(exarg_T *eap)
 {
-    if (*eap->arg != NUL && check_nextcmd(eap->arg) == NULL)
-	eap->errmsg = e_invarg;
-    else
-    {
-	/* ":hide" or ":hide | cmd": hide current window */
-	eap->nextcmd = check_nextcmd(eap->arg);
+    /* ":hide" or ":hide | cmd": hide current window */
 #ifdef FEAT_WINDOWS
-	if (!eap->skip)
-	{
+    if (!eap->skip)
+    {
 # ifdef FEAT_GUI
-	    need_mouse_correct = TRUE;
+	need_mouse_correct = TRUE;
 # endif
-	    if (eap->addr_count == 0)
-		win_close(curwin, FALSE);	/* don't free buffer */
-	    else
-	    {
-		int	winnr = 0;
-		win_T	*win;
-
-		FOR_ALL_WINDOWS(win)
-		{
-		    winnr++;
-		    if (winnr == eap->line2)
-			break;
-		}
-		if (win == NULL)
-		    win = lastwin;
-		win_close(win, FALSE);
-	    }
-	}
-#endif
-    }
+	if (eap->addr_count == 0)
+	    win_close(curwin, FALSE);	/* don't free buffer */
+	else
+	{
+	    int	winnr = 0;
+	    win_T	*win;
+
+	    FOR_ALL_WINDOWS(win)
+	    {
+		winnr++;
+		if (winnr == eap->line2)
+		    break;
+	    }
+	    if (win == NULL)
+		win = lastwin;
+	    win_close(win, FALSE);
+	}
+    }
+#endif
 }
 
 /*