Patch 8.0.0625
Problem:    shellescape() always escapes a newline, which does not work with
            some shells. (Harm te Hennepe)
Solution:   Only escape a newline when the "special" argument is non-zero.
            (Christian Brabandt, closes #1590)
Files:      src/evalfunc.c, src/testdir/test_functions.vim


*** ../vim-8.0.0624/src/evalfunc.c      2017-06-04 20:29:56.585724971 +0200
--- src/evalfunc.c      2017-06-05 18:35:41.622252634 +0200
***************
*** 10461,10468 ****
      static void
  f_shellescape(typval_T *argvars, typval_T *rettv)
  {
      rettv->vval.v_string = vim_strsave_shellescape(
!               get_tv_string(&argvars[0]), non_zero_arg(&argvars[1]), TRUE);
      rettv->v_type = VAR_STRING;
  }
  
--- 10461,10470 ----
      static void
  f_shellescape(typval_T *argvars, typval_T *rettv)
  {
+     int do_special = non_zero_arg(&argvars[1]);
+ 
      rettv->vval.v_string = vim_strsave_shellescape(
!                          get_tv_string(&argvars[0]), do_special, do_special);
      rettv->v_type = VAR_STRING;
  }
  
*** ../vim-8.0.0624/src/testdir/test_functions.vim      2017-04-07 
19:50:08.691049319 +0200
--- src/testdir/test_functions.vim      2017-06-05 18:41:42.475740381 +0200
***************
*** 784,786 ****
--- 784,811 ----
    delfunc Operator
    delfunc Apply
  endfunc
+ 
+ func Test_shellescape()
+   let save_shell = &shell
+   set shell=bash
+   call assert_equal("'text'", shellescape('text'))
+   call assert_equal("'te\"xt'", shellescape('te"xt'))
+   call assert_equal("'te'\\''xt'", shellescape("te'xt"))
+ 
+   call assert_equal("'te%xt'", shellescape("te%xt"))
+   call assert_equal("'te\\%xt'", shellescape("te%xt", 1))
+   call assert_equal("'te#xt'", shellescape("te#xt"))
+   call assert_equal("'te\\#xt'", shellescape("te#xt", 1))
+   call assert_equal("'te!xt'", shellescape("te!xt"))
+   call assert_equal("'te\\!xt'", shellescape("te!xt", 1))
+ 
+   call assert_equal("'te\nxt'", shellescape("te\nxt"))
+   call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1))
+   set shell=tcsh
+   call assert_equal("'te\\!xt'", shellescape("te!xt"))
+   call assert_equal("'te\\\\!xt'", shellescape("te!xt", 1))
+   call assert_equal("'te\\\nxt'", shellescape("te\nxt"))
+   call assert_equal("'te\\\\\nxt'", shellescape("te\nxt", 1))
+ 
+   let &shell = save_shell
+ endfunc
*** ../vim-8.0.0624/src/version.c       2017-06-05 17:53:33.475700562 +0200
--- src/version.c       2017-06-05 18:46:05.209950185 +0200
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     625,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
9. All your daydreaming is preoccupied with getting a faster connection to the
   net: 28.8...ISDN...cable modem...T1...T3.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui