patch 8.0.0086
Problem: Cannot add a comment after ":hide". (Norio Takagi)
Solution: Make it work, add a test. (Hirohito Higashi)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 34c21e1..439467c 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -5632,15 +5632,16 @@
#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 @@
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;
+ 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);
+ FOR_ALL_WINDOWS(win)
+ {
+ winnr++;
+ if (winnr == eap->line2)
+ break;
}
+ if (win == NULL)
+ win = lastwin;
+ win_close(win, FALSE);
}
-#endif
}
+#endif
}
/*