mirror of
https://github.com/vim/vim.git
synced 2025-11-14 23:04:02 -05:00
patch 9.1.0535: newline escape wrong in ex mode
Problem: newline escape wrong in ex mode (Konrad Schwarz)
Solution: partly revert patch 7.3.014, remove backslash in front of a
newline when not in prompt mode in ex line mode
(Mohamed Akram)
This fixes newline escaping to allow passing multiple commands to
":global", multiple lines to shell commands, and ending lines in append
mode with backslashes. This should fix a POSIX/(traditional) VI
incompatiblity.
This reverts a previous incorrect attempt at patch v7.3.014 to fix
append mode which removed half of trailing backslashes which lead to,
eg. the following two commands being parsed as having a different number
of backslashes:
```
!echo foo\\\
```
```
!echo foo\\ \
```
fixes: #6135
fixes: #7244
closes: #15120
Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
84ca1388d8
commit
f3daa4525b
@@ -2341,12 +2341,7 @@ do_one_cmd(
|
||||
{
|
||||
for (p = ea.arg; *p; ++p)
|
||||
{
|
||||
// Remove one backslash before a newline, so that it's possible to
|
||||
// pass a newline to the shell and also a newline that is preceded
|
||||
// with a backslash. This makes it impossible to end a shell
|
||||
// command in a backslash, but that doesn't appear useful.
|
||||
// Halving the number of backslashes is incompatible with previous
|
||||
// versions.
|
||||
// Remove one backslash before a newline
|
||||
if (*p == '\\' && p[1] == '\n')
|
||||
STRMOVE(p, p + 1);
|
||||
else if (*p == '\n' && !(ea.argt & EX_EXPR_ARG))
|
||||
|
||||
Reference in New Issue
Block a user