[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ex: fix newline escaping #15120

Closed
wants to merge 1 commit into from
Closed

Conversation

mohd-akram
Copy link
Contributor
@mohd-akram mohd-akram commented Jun 28, 2024

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 reverts a previous incorrect attempt 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

@konrad-schwarz

@mohd-akram mohd-akram force-pushed the fix-global-shell branch 2 times, most recently from 2de90ca to 3b2435a Compare June 28, 2024 19:53
@mohd-akram mohd-akram changed the title ex: fix multiple global commands and shell lines ex: fix newline escaping Jun 28, 2024
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 reverts a previous incorrect attempt 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\\ \
```
@mohd-akram
Copy link
Contributor Author

The fix for this turned out to be much simpler. The culprit was 417f5e7, so ex mode has been broken for around 14 years...

@chrisbra
Copy link
Member
chrisbra commented Jul 6, 2024

Thanks!

@chrisbra chrisbra closed this in f3daa45 Jul 6, 2024
@mohd-akram mohd-akram deleted the fix-global-shell branch July 6, 2024 15:20
@k-takata
Copy link
Member
k-takata commented Jul 6, 2024

Does this just revert 7.3.014?
The issue that 7.3.014 tried to solve is unresolved?

@mohd-akram
Copy link
Contributor Author

It is resolved. We fix it correctly by not interpreting backslashes at all in insert mode.

mohd-akram added a commit to mohd-akram/vim that referenced this pull request Jul 7, 2024
related: vim#15120

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
mohd-akram added a commit to mohd-akram/vim that referenced this pull request Jul 7, 2024
related: vim#15120

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
@chrisbra
Copy link
Member
chrisbra commented Jul 7, 2024

It's not completely reverted, there is an added check for !promptc var.

There were some discussions around 7.3.014: https://groups.google.com/g/vim_dev/c/F5-tDqoafz8/m/GqKF-uQsLD0J

The example mentioned in this thread:

To recreate the problem, perform the following:
cat - > ex.input << EOF
a
X \\
Y
.
w ex.output
EOF
cat -tvse ex.input
ex - -u NONE < ex.input
cat -tvse ex.output

When working correctly (rhel4), the output from cat of ex.output is:
$
X \$
Y$ 

This works now correctly. Should probably turn this into a test as well.

chrisbra added a commit that referenced this pull request Jul 7, 2024
Problem:  Not enough tests for what v9.1.0535 fixed
Solution: Add another test for ex-mode

This comes from: https://groups.google.com/g/vim_dev/c/F5-tDqoafz8/m/GqKF-uQsLD0J

related: #15120

Signed-off-by: Christian Brabandt <cb@256bit.org>
RestorerZ pushed a commit to RestorerZ/fork_vim-orig that referenced this pull request Jul 9, 2024
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: vim#6135
fixes: vim#7244
closes: vim#15120

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
RestorerZ pushed a commit to RestorerZ/fork_vim-orig that referenced this pull request Jul 9, 2024
Problem:  Not enough tests for what v9.1.0535 fixed
Solution: Add another test for ex-mode

This comes from: https://groups.google.com/g/vim_dev/c/F5-tDqoafz8/m/GqKF-uQsLD0J

related: vim#15120

Signed-off-by: Christian Brabandt <cb@256bit.org>
chrisbra pushed a commit that referenced this pull request Jul 12, 2024
related: #15120
closes: #15228

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jul 12, 2024
related: vim/vim#15120
closes: vim/vim#15228

vim/vim@74703f1

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jul 12, 2024
related: vim/vim#15120
closes: vim/vim#15228

vim/vim@74703f1

Nvim only supports Vim Ex mode, so this is long obsolete in Nvim.

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
zeertzjq added a commit to neovim/neovim that referenced this pull request Jul 12, 2024
…29678)

related: vim/vim#15120
closes: vim/vim#15228

vim/vim@74703f1

Nvim only supports Vim Ex mode, so this is long obsolete in Nvim.

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
mohd-akram added a commit to mohd-akram/vim that referenced this pull request Jul 13, 2024
related: vim#15120

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
github-actions bot pushed a commit to neovim/neovim that referenced this pull request Jul 14, 2024
…29678)

related: vim/vim#15120
closes: vim/vim#15228

vim/vim@74703f1

Nvim only supports Vim Ex mode, so this is long obsolete in Nvim.

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
(cherry picked from commit 10256bb)
zeertzjq pushed a commit to neovim/neovim that referenced this pull request Jul 14, 2024
…29702)

related: vim/vim#15120
closes: vim/vim#15228

vim/vim@74703f1

Nvim only supports Vim Ex mode, so this is long obsolete in Nvim.

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
chrisbra pushed a commit that referenced this pull request Jul 14, 2024
This is a partial revert of 8f3f58f since this issue was fixed in #15120.

related: #15120

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants