mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
vim-patch:9.1.0574: ex: wrong handling of commands after bar
Problem: ex: wrong handling of commands after bar
Solution: for :append, :insert and :change use the text after the bar
as input for those commands. This is what POSIX requests.
(Mohamed Akram)
See the POSIX Spec:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html#tag_20_40_13_03
Section 12.c
closes: vim/vim#15229
8c446da349
Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
This commit is contained in:
@@ -2784,7 +2784,11 @@ void ex_append(exarg_T *eap)
|
||||
indent = get_indent_lnum(lnum);
|
||||
}
|
||||
}
|
||||
if (eap->ea_getline == NULL) {
|
||||
if (*eap->arg == '|') {
|
||||
// Get the text after the trailing bar.
|
||||
theline = xstrdup(eap->arg + 1);
|
||||
*eap->arg = NUL;
|
||||
} else if (eap->ea_getline == NULL) {
|
||||
// No getline() function, use the lines that follow. This ends
|
||||
// when there is no more.
|
||||
if (eap->nextcmd == NULL || *eap->nextcmd == NUL) {
|
||||
|
@@ -4108,7 +4108,12 @@ void separate_nextcmd(exarg_T *eap)
|
||||
&& !(eap->argt & EX_NOTRLCOM)
|
||||
&& (eap->cmdidx != CMD_at || p != eap->arg)
|
||||
&& (eap->cmdidx != CMD_redir
|
||||
|| p != eap->arg + 1 || p[-1] != '@')) || *p == '|' || *p == '\n') {
|
||||
|| p != eap->arg + 1 || p[-1] != '@'))
|
||||
|| (*p == '|'
|
||||
&& eap->cmdidx != CMD_append
|
||||
&& eap->cmdidx != CMD_change
|
||||
&& eap->cmdidx != CMD_insert)
|
||||
|| *p == '\n') {
|
||||
// We remove the '\' before the '|', unless EX_CTRLV is used
|
||||
// AND 'b' is present in 'cpoptions'.
|
||||
if ((vim_strchr(p_cpo, CPO_BAR) == NULL
|
||||
|
Reference in New Issue
Block a user