Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
10382:61ca29e3f2a4 | 10383:b59df2194b01 |
---|---|
5630 return (p + 1); | 5630 return (p + 1); |
5631 } | 5631 } |
5632 #endif | 5632 #endif |
5633 | 5633 |
5634 /* | 5634 /* |
5635 * Check if *p is a separator between Ex commands. | 5635 * Check if *p is a separator between Ex commands, skipping over white space. |
5636 * Return NULL if it isn't, (p + 1) if it is. | 5636 * Return NULL if it isn't, the following character if it is. |
5637 */ | 5637 */ |
5638 char_u * | 5638 char_u * |
5639 check_nextcmd(char_u *p) | 5639 check_nextcmd(char_u *p) |
5640 { | 5640 { |
5641 p = skipwhite(p); | 5641 char_u *s = skipwhite(p); |
5642 if (*p == '|' || *p == '\n') | 5642 |
5643 return (p + 1); | 5643 if (*s == '|' || *s == '\n') |
5644 return (s + 1); | |
5644 else | 5645 else |
5645 return NULL; | 5646 return NULL; |
5646 } | 5647 } |
5647 | 5648 |
5648 /* | 5649 /* |
7570 #endif /* FEAT_WINDOWS */ | 7571 #endif /* FEAT_WINDOWS */ |
7571 | 7572 |
7572 static void | 7573 static void |
7573 ex_hide(exarg_T *eap) | 7574 ex_hide(exarg_T *eap) |
7574 { | 7575 { |
7575 if (*eap->arg != NUL && check_nextcmd(eap->arg) == NULL) | 7576 /* ":hide" or ":hide | cmd": hide current window */ |
7576 eap->errmsg = e_invarg; | |
7577 else | |
7578 { | |
7579 /* ":hide" or ":hide | cmd": hide current window */ | |
7580 eap->nextcmd = check_nextcmd(eap->arg); | |
7581 #ifdef FEAT_WINDOWS | 7577 #ifdef FEAT_WINDOWS |
7582 if (!eap->skip) | 7578 if (!eap->skip) |
7583 { | 7579 { |
7584 # ifdef FEAT_GUI | 7580 # ifdef FEAT_GUI |
7585 need_mouse_correct = TRUE; | 7581 need_mouse_correct = TRUE; |
7586 # endif | 7582 # endif |
7587 if (eap->addr_count == 0) | 7583 if (eap->addr_count == 0) |
7588 win_close(curwin, FALSE); /* don't free buffer */ | 7584 win_close(curwin, FALSE); /* don't free buffer */ |
7589 else | 7585 else |
7586 { | |
7587 int winnr = 0; | |
7588 win_T *win; | |
7589 | |
7590 FOR_ALL_WINDOWS(win) | |
7590 { | 7591 { |
7591 int winnr = 0; | 7592 winnr++; |
7592 win_T *win; | 7593 if (winnr == eap->line2) |
7593 | 7594 break; |
7594 FOR_ALL_WINDOWS(win) | |
7595 { | |
7596 winnr++; | |
7597 if (winnr == eap->line2) | |
7598 break; | |
7599 } | |
7600 if (win == NULL) | |
7601 win = lastwin; | |
7602 win_close(win, FALSE); | |
7603 } | 7595 } |
7604 } | 7596 if (win == NULL) |
7605 #endif | 7597 win = lastwin; |
7606 } | 7598 win_close(win, FALSE); |
7599 } | |
7600 } | |
7601 #endif | |
7607 } | 7602 } |
7608 | 7603 |
7609 /* | 7604 /* |
7610 * ":stop" and ":suspend": Suspend Vim. | 7605 * ":stop" and ":suspend": Suspend Vim. |
7611 */ | 7606 */ |