mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 00:08:19 +00:00
vim-patch:8.0.0086 (#7118)
Problem: Cannot add a comment after ":hide". (Norio Takagi)
Solution: Make it work, add a test. (Hirohito Higashi)
2256c99471
This commit is contained in:

committed by
Justin M. Keyes

parent
5bec94652c
commit
36ceb9397c
@@ -4674,17 +4674,17 @@ char_u *find_nextcmd(const char_u *p)
|
||||
return (char_u *)p + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
else
|
||||
return NULL;
|
||||
char_u *s = skipwhite(p);
|
||||
|
||||
if (*s == '|' || *s == '\n') {
|
||||
return (s + 1);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -6254,31 +6254,27 @@ void 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
|
||||
if (!eap->skip) {
|
||||
if (eap->addr_count == 0)
|
||||
win_close(curwin, FALSE); /* don't free buffer */
|
||||
else {
|
||||
int winnr = 0;
|
||||
win_T *win = NULL;
|
||||
if (eap->addr_count == 0) {
|
||||
win_close(curwin, false); // don't free buffer
|
||||
} else {
|
||||
int winnr = 0;
|
||||
win_T *win = NULL;
|
||||
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||
winnr++;
|
||||
if (winnr == eap->line2) {
|
||||
win = wp;
|
||||
break;
|
||||
}
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||
winnr++;
|
||||
if (winnr == eap->line2) {
|
||||
win = wp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (win == NULL) {
|
||||
win = lastwin;
|
||||
}
|
||||
win_close(win, false);
|
||||
}
|
||||
if (win == NULL)
|
||||
win = lastwin;
|
||||
win_close(win, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user