4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: ":mksession" does not square brackets escape file name properly.
12 Solution: Improve escapging of file names. (partly by Peter Odding)
16 *** ../vim-7.3.024/src/ex_docmd.c 2010-09-21 16:56:29.000000000 +0200
17 --- src/ex_docmd.c 2010-10-13 17:39:17.000000000 +0200
20 * Write a file name to the session file.
21 * Takes care of the "slash" option in 'sessionoptions' and escapes special
23 ! * Returns FAIL if writing fails.
26 ses_put_fname(fd, name, flagp)
28 * Write a file name to the session file.
29 * Takes care of the "slash" option in 'sessionoptions' and escapes special
31 ! * Returns FAIL if writing fails or out of memory.
34 ses_put_fname(fd, name, flagp)
43 sname = home_replace_save(NULL, name);
46 ! while (*name != NUL)
52 ! if (has_mbyte && (l = (*mb_ptr2len)(name)) > 1)
54 ! /* copy a multibyte char */
57 ! if (putc(*name, fd) != *name)
66 ! if (c == '\\' && (*flagp & SSOP_SLASH))
67 ! /* change a backslash to a forward slash */
69 ! else if ((vim_strchr(escape_chars, c) != NULL
70 ! #ifdef BACKSLASH_IN_FILENAME
73 ! ) || c == '#' || c == '%')
75 ! /* escape a special character with a backslash */
76 ! if (putc('\\', fd) != '\\')
79 ! if (putc(c, fd) != c)
93 sname = home_replace_save(NULL, name);
97 ! if (*flagp & SSOP_SLASH)
99 ! /* change all backslashes to forward slashes */
100 ! for (p = sname; *p != NUL; mb_ptr_adv(p))
105 + /* escapse special characters */
106 + p = vim_strsave_fnameescape(sname, FALSE);
111 + /* write the result */
112 + if (fputs((char *)p, fd) < 0)
119 *** ../vim-7.3.024/src/version.c 2010-10-13 16:44:17.000000000 +0200
120 --- src/version.c 2010-10-13 17:49:15.000000000 +0200
124 { /* Add new patch number below this line */
130 "Time flies like an arrow". So I put an arrow on my desk, now
131 awaiting one of these time flies showing up.
133 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
134 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
135 \\\ download, build and distribute -- http://www.A-A-P.org ///
136 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///