]> granicus.if.org Git - vim/commitdiff
patch 8.1.0803: session file has problem with single quote in file name v8.1.0803
authorBram Moolenaar <Bram@vim.org>
Thu, 24 Jan 2019 12:34:42 +0000 (13:34 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 24 Jan 2019 12:34:42 +0000 (13:34 +0100)
Problem:    Session file has problem with single quote in file name. (Jon
            Crowe)
Solution:   Use a double quoted string.  Add a test.

src/ex_docmd.c
src/testdir/test_mksession.vim
src/version.c

index f60bb3492cad69ede53c619145aeef8be27e2c0b..210fdfa596f75c1ebae9ed731bb8ff691734a3a4 100644 (file)
@@ -11838,9 +11838,9 @@ put_view(
             * edit that buffer, to not lose folding information (:edit resets
             * folds in other buffers)
             */
-           if (fputs("if bufexists('", fd) < 0
+           if (fputs("if bufexists(\"", fd) < 0
                    || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
-                   || fputs("') | buffer ", fd) < 0
+                   || fputs("\") | buffer ", fd) < 0
                    || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
                    || fputs(" | else | edit ", fd) < 0
                    || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
index 00631f13f8a6e457abe7bcc1fb0262a1720198fd..145c91cba5f7a2dcc375f1225bd6b11aac43a700 100644 (file)
@@ -426,5 +426,19 @@ func Test_mksession_no_errmsg()
   call delete('Xtest_mks.out')
 endfunc
 
+func Test_mksession_quote_in_filename()
+  let v:errmsg = ''
+  %bwipe!
+  split another
+  split x'y\"z
+  mksession! Xtest_mks_quoted.out
+  %bwipe!
+  source Xtest_mks_quoted.out
+  call assert_true(bufexists("x'y\"z"))
+
+  %bwipe!
+  call delete('Xtest_mks_quoted.out')
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab
index 5b404ed8043f5b8f44b89313736344dffdf809fe..dcbf1c2824ea0375ce2ecac30ad7b4a422fd60a2 100644 (file)
@@ -791,6 +791,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    803,
 /**/
     802,
 /**/