aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-03-25 14:20:29 -0400
committerJames McCoy <jamessan@jamessan.com>2016-03-30 08:30:35 -0400
commite4d1bf7177e00eb41928bd17ae4c3c936f047053 (patch)
treef8be47db7fb482fd7c793a2de6101832c864856f
parent5f0c76b243aca8d5fcab15c24bf2b0ba33852155 (diff)
downloadrneovim-e4d1bf7177e00eb41928bd17ae4c3c936f047053.tar.gz
rneovim-e4d1bf7177e00eb41928bd17ae4c3c936f047053.tar.bz2
rneovim-e4d1bf7177e00eb41928bd17ae4c3c936f047053.zip
vim-patch:7.4.1643
Problem: Terminating file name has side effects. Solution: Restore the character. (mostly by James McCoy, closes vim/vim#713) https://github.com/vim/vim/commit/d4caf5c16a9f1c9477d426e58d8d3dc47ab5f066
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/version.c1
-rw-r--r--test/functional/legacy/105_filename_modifiers_spec.lua4
3 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 3856edbef9..fbde845f47 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -21994,8 +21994,10 @@ repeat:
if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S') {
// vim_strsave_shellescape() needs a NUL terminated string.
+ c = (*fnamep)[*fnamelen];
(*fnamep)[*fnamelen] = NUL;
p = vim_strsave_shellescape(*fnamep, false, false);
+ (*fnamep)[*fnamelen] = c;
xfree(*bufp);
*bufp = *fnamep = p;
*fnamelen = STRLEN(p);
diff --git a/src/nvim/version.c b/src/nvim/version.c
index b7e5f1f2ef..0889ba8ccf 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -69,6 +69,7 @@ static char *features[] = {
// clang-format off
static int included_patches[] = {
+ 1643,
1641,
1574,
1570,
diff --git a/test/functional/legacy/105_filename_modifiers_spec.lua b/test/functional/legacy/105_filename_modifiers_spec.lua
index 5ce2024889..f7eb48e1da 100644
--- a/test/functional/legacy/105_filename_modifiers_spec.lua
+++ b/test/functional/legacy/105_filename_modifiers_spec.lua
@@ -44,6 +44,9 @@ describe('filename modifiers', function()
execute([=[Put fnamemodify('abc''%''def', ':S' )]=])
execute([=[Put fnamemodify("abc\ndef", ':S' )]=])
execute([=[Put expand('%:r:S') == shellescape(expand('%:r'))]=])
+ execute([=[new foo.txt]=])
+ execute([=[Put join([expand('%:r'), expand('%:r:S'), expand('%')], ',')]=])
+ execute([=[quit]=])
execute([=[set shell=tcsh]=])
execute([=[Put fnamemodify("abc\ndef", ':S' )]=])
execute([=[1 delete _]=])
@@ -77,6 +80,7 @@ describe('filename modifiers', function()
fnamemodify('abc'' ''def', ':S' ) '''abc''\'''' ''\''''def'''
fnamemodify('abc''%''def', ':S' ) '''abc''\''''%''\''''def'''
fnamemodify("abc\ndef", ':S' ) '''abc^@def'''
+ join([expand('%:r'), expand('%:r:S'), expand('%')], ',') 'foo,''foo'',foo.txt'
expand('%:r:S') == shellescape(expand('%:r')) 1
fnamemodify("abc\ndef", ':S' ) '''abc\^@def''']=])
end)