1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: After using "expand('%:8')" the buffer name is changed.
12 Solution: Make a copy of the file name before shortening it.
16 *** ../vim-7.3.280/src/eval.c 2011-08-10 12:38:02.000000000 +0200
17 --- src/eval.c 2011-08-17 15:12:39.000000000 +0200
24 + char_u *fname_start = *fnamep;
25 int has_shortname = 0;
33 ! /* Check shortname after we have done 'heads' and before we do 'tails'
38 ! /* Copy the string if it is shortened by :h */
39 ! if (*fnamelen < (int)STRLEN(*fnamep))
41 p = vim_strnsave(*fnamep, *fnamelen);
48 /* Split into two implementations - makes it easier. First is where
49 ! * there isn't a full name already, second is where there is.
51 if (!has_fullname && !vim_isAbsName(*fnamep))
53 if (shortpath_for_partial(fnamep, bufp, fnamelen) == FAIL)
59 ! * Handle ":8" after we have done 'heads' and before we do 'tails'.
63 ! /* Copy the string if it is shortened by :h and when it wasn't copied
64 ! * yet, because we are going to change it in place. Avoids changing
65 ! * the buffer name for "%:8". */
66 ! if (*fnamelen < (int)STRLEN(*fnamep) || *fnamep == fname_start)
68 p = vim_strnsave(*fnamep, *fnamelen);
75 /* Split into two implementations - makes it easier. First is where
76 ! * there isn't a full name already, second is where there is. */
77 if (!has_fullname && !vim_isAbsName(*fnamep))
79 if (shortpath_for_partial(fnamep, bufp, fnamelen) == FAIL)
87 ! /* Simple case, already have the full-name
88 * Nearly always shorter, so try first time. */
90 if (get_short_pathname(fnamep, bufp, &l) == FAIL)
95 ! /* Couldn't find the filename.. search the paths.
98 if (shortpath_for_invalid_fname(fnamep, bufp, &l) == FAIL)
106 ! /* Simple case, already have the full-name.
107 * Nearly always shorter, so try first time. */
108 if (get_short_pathname(fnamep, bufp, &l) == FAIL)
113 ! /* Couldn't find the filename, search the paths. */
115 if (shortpath_for_invalid_fname(fnamep, bufp, &l) == FAIL)
117 *** ../vim-7.3.280/src/version.c 2011-08-10 18:36:49.000000000 +0200
118 --- src/version.c 2011-08-17 15:21:41.000000000 +0200
122 { /* Add new patch number below this line */
128 Kisses may last for as much as, but no more than, five minutes.
129 [real standing law in Iowa, United States of America]
131 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
132 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
133 \\\ an exciting new programming language -- http://www.Zimbu.org ///
134 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///