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: #15229
Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 8143c24..c365937 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3360,7 +3360,13 @@
indent = get_indent_lnum(lnum);
}
ex_keep_indent = FALSE;
- if (eap->ea_getline == NULL)
+ if (*eap->arg == '|')
+ {
+ // Get the text after the trailing bar.
+ theline = vim_strsave(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.