]>
Commit | Line | Data |
---|---|---|
b99d7393 | 1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.281 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.281 | |
11 | Problem: After using "expand('%:8')" the buffer name is changed. | |
12 | Solution: Make a copy of the file name before shortening it. | |
13 | Files: src/eval.c | |
14 | ||
15 | ||
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 | |
18 | *************** | |
19 | *** 23205,23210 **** | |
20 | --- 23205,23211 ---- | |
21 | int c; | |
22 | int has_fullname = 0; | |
23 | #ifdef WIN3264 | |
24 | + char_u *fname_start = *fnamep; | |
25 | int has_shortname = 0; | |
26 | #endif | |
27 | ||
28 | *************** | |
29 | *** 23379,23402 **** | |
30 | } | |
31 | ||
32 | #ifdef WIN3264 | |
33 | ! /* Check shortname after we have done 'heads' and before we do 'tails' | |
34 | */ | |
35 | if (has_shortname) | |
36 | { | |
37 | ! pbuf = NULL; | |
38 | ! /* Copy the string if it is shortened by :h */ | |
39 | ! if (*fnamelen < (int)STRLEN(*fnamep)) | |
40 | { | |
41 | p = vim_strnsave(*fnamep, *fnamelen); | |
42 | ! if (p == 0) | |
43 | return -1; | |
44 | vim_free(*bufp); | |
45 | *bufp = *fnamep = p; | |
46 | } | |
47 | ||
48 | /* Split into two implementations - makes it easier. First is where | |
49 | ! * there isn't a full name already, second is where there is. | |
50 | ! */ | |
51 | if (!has_fullname && !vim_isAbsName(*fnamep)) | |
52 | { | |
53 | if (shortpath_for_partial(fnamep, bufp, fnamelen) == FAIL) | |
54 | --- 23380,23404 ---- | |
55 | } | |
56 | ||
57 | #ifdef WIN3264 | |
58 | ! /* | |
59 | ! * Handle ":8" after we have done 'heads' and before we do 'tails'. | |
60 | */ | |
61 | if (has_shortname) | |
62 | { | |
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) | |
67 | { | |
68 | p = vim_strnsave(*fnamep, *fnamelen); | |
69 | ! if (p == NULL) | |
70 | return -1; | |
71 | vim_free(*bufp); | |
72 | *bufp = *fnamep = p; | |
73 | } | |
74 | ||
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)) | |
78 | { | |
79 | if (shortpath_for_partial(fnamep, bufp, fnamelen) == FAIL) | |
80 | *************** | |
81 | *** 23404,23421 **** | |
82 | } | |
83 | else | |
84 | { | |
85 | ! int l; | |
86 | ||
87 | ! /* Simple case, already have the full-name | |
88 | * Nearly always shorter, so try first time. */ | |
89 | - l = *fnamelen; | |
90 | if (get_short_pathname(fnamep, bufp, &l) == FAIL) | |
91 | return -1; | |
92 | ||
93 | if (l == 0) | |
94 | { | |
95 | ! /* Couldn't find the filename.. search the paths. | |
96 | ! */ | |
97 | l = *fnamelen; | |
98 | if (shortpath_for_invalid_fname(fnamep, bufp, &l) == FAIL) | |
99 | return -1; | |
100 | --- 23406,23421 ---- | |
101 | } | |
102 | else | |
103 | { | |
104 | ! int l = *fnamelen; | |
105 | ||
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) | |
109 | return -1; | |
110 | ||
111 | if (l == 0) | |
112 | { | |
113 | ! /* Couldn't find the filename, search the paths. */ | |
114 | l = *fnamelen; | |
115 | if (shortpath_for_invalid_fname(fnamep, bufp, &l) == FAIL) | |
116 | return -1; | |
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 | |
119 | *************** | |
120 | *** 711,712 **** | |
121 | --- 711,714 ---- | |
122 | { /* Add new patch number below this line */ | |
123 | + /**/ | |
124 | + 281, | |
125 | /**/ | |
126 | ||
127 | -- | |
128 | Kisses may last for as much as, but no more than, five minutes. | |
129 | [real standing law in Iowa, United States of America] | |
130 | ||
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 /// |