]>
Commit | Line | Data |
---|---|---|
60bfb38b AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.305 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.305 | |
11 | Problem: Editing a compressed file with special characters in the name | |
12 | doesn't work properly. | |
13 | Solution: Escape special characters. | |
14 | Files: runtime/autoload/gzip.vim | |
15 | ||
16 | ||
17 | *** ../vim-7.1.304/runtime/autoload/gzip.vim Thu May 10 18:54:26 2007 | |
18 | --- runtime/autoload/gzip.vim Thu May 29 22:30:59 2008 | |
19 | *************** | |
20 | *** 1,6 **** | |
21 | " Vim autoload file for editing compressed files. | |
22 | " Maintainer: Bram Moolenaar <Bram@vim.org> | |
23 | ! " Last Change: 2007 May 10 | |
24 | ||
25 | " These functions are used by the gzip plugin. | |
26 | ||
27 | --- 1,6 ---- | |
28 | " Vim autoload file for editing compressed files. | |
29 | " Maintainer: Bram Moolenaar <Bram@vim.org> | |
30 | ! " Last Change: 2008 May 29 | |
31 | ||
32 | " These functions are used by the gzip plugin. | |
33 | ||
34 | *************** | |
35 | *** 73,80 **** | |
36 | let empty = line("'[") == 1 && line("']") == line("$") | |
37 | let tmp = tempname() | |
38 | let tmpe = tmp . "." . expand("<afile>:e") | |
39 | " write the just read lines to a temp file "'[,']w tmp.gz" | |
40 | ! execute "silent '[,']w " . escape(tmpe, ' ') | |
41 | " uncompress the temp file: call system("gzip -dn tmp.gz") | |
42 | call system(a:cmd . " " . s:escape(tmpe)) | |
43 | if !filereadable(tmp) | |
44 | --- 73,87 ---- | |
45 | let empty = line("'[") == 1 && line("']") == line("$") | |
46 | let tmp = tempname() | |
47 | let tmpe = tmp . "." . expand("<afile>:e") | |
48 | + if exists('*fnameescape') | |
49 | + let tmp_esc = fnameescape(tmp) | |
50 | + let tmpe_esc = fnameescape(tmpe) | |
51 | + else | |
52 | + let tmp_esc = escape(tmp, ' ') | |
53 | + let tmpe_esc = escape(tmpe, ' ') | |
54 | + endif | |
55 | " write the just read lines to a temp file "'[,']w tmp.gz" | |
56 | ! execute "silent '[,']w " . tmpe_esc | |
57 | " uncompress the temp file: call system("gzip -dn tmp.gz") | |
58 | call system(a:cmd . " " . s:escape(tmpe)) | |
59 | if !filereadable(tmp) | |
60 | *************** | |
61 | *** 95,106 **** | |
62 | setlocal nobin | |
63 | if exists(":lockmarks") | |
64 | if empty | |
65 | ! execute "silent lockmarks " . l . "r ++edit " . tmp | |
66 | else | |
67 | ! execute "silent lockmarks " . l . "r " . tmp | |
68 | endif | |
69 | else | |
70 | ! execute "silent " . l . "r " . tmp | |
71 | endif | |
72 | ||
73 | " if buffer became empty, delete trailing blank line | |
74 | --- 102,113 ---- | |
75 | setlocal nobin | |
76 | if exists(":lockmarks") | |
77 | if empty | |
78 | ! execute "silent lockmarks " . l . "r ++edit " . tmp_esc | |
79 | else | |
80 | ! execute "silent lockmarks " . l . "r " . tmp_esc | |
81 | endif | |
82 | else | |
83 | ! execute "silent " . l . "r " . tmp_esc | |
84 | endif | |
85 | ||
86 | " if buffer became empty, delete trailing blank line | |
87 | *************** | |
88 | *** 110,117 **** | |
89 | endif | |
90 | " delete the temp file and the used buffers | |
91 | call delete(tmp) | |
92 | ! silent! exe "bwipe " . tmp | |
93 | ! silent! exe "bwipe " . tmpe | |
94 | endif | |
95 | ||
96 | " Restore saved option values. | |
97 | --- 117,124 ---- | |
98 | endif | |
99 | " delete the temp file and the used buffers | |
100 | call delete(tmp) | |
101 | ! silent! exe "bwipe " . tmp_esc | |
102 | ! silent! exe "bwipe " . tmpe_esc | |
103 | endif | |
104 | ||
105 | " Restore saved option values. | |
106 | *************** | |
107 | *** 124,133 **** | |
108 | ||
109 | " When uncompressed the whole buffer, do autocommands | |
110 | if ok && empty | |
111 | if &verbose >= 8 | |
112 | ! execute "doau BufReadPost " . expand("%:r") | |
113 | else | |
114 | ! execute "silent! doau BufReadPost " . expand("%:r") | |
115 | endif | |
116 | endif | |
117 | endfun | |
118 | --- 131,145 ---- | |
119 | ||
120 | " When uncompressed the whole buffer, do autocommands | |
121 | if ok && empty | |
122 | + if exists('*fnameescape') | |
123 | + let fname = fnameescape(expand("%:r")) | |
124 | + else | |
125 | + let fname = escape(expand("%:r"), " \t\n*?[{`$\\%#'\"|!<") | |
126 | + endif | |
127 | if &verbose >= 8 | |
128 | ! execute "doau BufReadPost " . fname | |
129 | else | |
130 | ! execute "silent! doau BufReadPost " . fname | |
131 | endif | |
132 | endif | |
133 | endfun | |
134 | *** ../vim-7.1.304/src/version.c Thu May 29 21:46:10 2008 | |
135 | --- src/version.c Thu May 29 22:33:11 2008 | |
136 | *************** | |
137 | *** 668,669 **** | |
138 | --- 673,676 ---- | |
139 | { /* Add new patch number below this line */ | |
140 | + /**/ | |
141 | + 305, | |
142 | /**/ | |
143 | ||
144 | -- | |
145 | OLD WOMAN: Well, how did you become king, then? | |
146 | ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite, | |
147 | held Excalibur aloft from the bosom of the water to signify by Divine | |
148 | Providence ... that I, Arthur, was to carry Excalibur ... That is | |
149 | why I am your king! | |
150 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
151 | ||
152 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
153 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
154 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
155 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |