| To: vim-dev@vim.org |
| Subject: Patch 7.1.305 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.1.305 |
| Problem: Editing a compressed file with special characters in the name |
| doesn't work properly. |
| Solution: Escape special characters. |
| Files: runtime/autoload/gzip.vim |
| |
| |
| |
| |
| |
| *** 1,6 **** |
| " Vim autoload file for editing compressed files. |
| " Maintainer: Bram Moolenaar <Bram@vim.org> |
| ! " Last Change: 2007 May 10 |
| |
| " These functions are used by the gzip plugin. |
| |
| --- 1,6 ---- |
| " Vim autoload file for editing compressed files. |
| " Maintainer: Bram Moolenaar <Bram@vim.org> |
| ! " Last Change: 2008 May 29 |
| |
| " These functions are used by the gzip plugin. |
| |
| |
| *** 73,80 **** |
| let empty = line("'[") == 1 && line("']") == line("$") |
| let tmp = tempname() |
| let tmpe = tmp . "." . expand("<afile>:e") |
| " write the just read lines to a temp file "'[,']w tmp.gz" |
| ! execute "silent '[,']w " . escape(tmpe, ' ') |
| " uncompress the temp file: call system("gzip -dn tmp.gz") |
| call system(a:cmd . " " . s:escape(tmpe)) |
| if !filereadable(tmp) |
| --- 73,87 ---- |
| let empty = line("'[") == 1 && line("']") == line("$") |
| let tmp = tempname() |
| let tmpe = tmp . "." . expand("<afile>:e") |
| + if exists('*fnameescape') |
| + let tmp_esc = fnameescape(tmp) |
| + let tmpe_esc = fnameescape(tmpe) |
| + else |
| + let tmp_esc = escape(tmp, ' ') |
| + let tmpe_esc = escape(tmpe, ' ') |
| + endif |
| " write the just read lines to a temp file "'[,']w tmp.gz" |
| ! execute "silent '[,']w " . tmpe_esc |
| " uncompress the temp file: call system("gzip -dn tmp.gz") |
| call system(a:cmd . " " . s:escape(tmpe)) |
| if !filereadable(tmp) |
| |
| *** 95,106 **** |
| setlocal nobin |
| if exists(":lockmarks") |
| if empty |
| ! execute "silent lockmarks " . l . "r ++edit " . tmp |
| else |
| ! execute "silent lockmarks " . l . "r " . tmp |
| endif |
| else |
| ! execute "silent " . l . "r " . tmp |
| endif |
| |
| " if buffer became empty, delete trailing blank line |
| --- 102,113 ---- |
| setlocal nobin |
| if exists(":lockmarks") |
| if empty |
| ! execute "silent lockmarks " . l . "r ++edit " . tmp_esc |
| else |
| ! execute "silent lockmarks " . l . "r " . tmp_esc |
| endif |
| else |
| ! execute "silent " . l . "r " . tmp_esc |
| endif |
| |
| " if buffer became empty, delete trailing blank line |
| |
| *** 110,117 **** |
| endif |
| " delete the temp file and the used buffers |
| call delete(tmp) |
| ! silent! exe "bwipe " . tmp |
| ! silent! exe "bwipe " . tmpe |
| endif |
| |
| " Restore saved option values. |
| --- 117,124 ---- |
| endif |
| " delete the temp file and the used buffers |
| call delete(tmp) |
| ! silent! exe "bwipe " . tmp_esc |
| ! silent! exe "bwipe " . tmpe_esc |
| endif |
| |
| " Restore saved option values. |
| |
| *** 124,133 **** |
| |
| " When uncompressed the whole buffer, do autocommands |
| if ok && empty |
| if &verbose >= 8 |
| ! execute "doau BufReadPost " . expand("%:r") |
| else |
| ! execute "silent! doau BufReadPost " . expand("%:r") |
| endif |
| endif |
| endfun |
| --- 131,145 ---- |
| |
| " When uncompressed the whole buffer, do autocommands |
| if ok && empty |
| + if exists('*fnameescape') |
| + let fname = fnameescape(expand("%:r")) |
| + else |
| + let fname = escape(expand("%:r"), " \t\n*?[{`$\\%#'\"|!<") |
| + endif |
| if &verbose >= 8 |
| ! execute "doau BufReadPost " . fname |
| else |
| ! execute "silent! doau BufReadPost " . fname |
| endif |
| endif |
| endfun |
| |
| |
| |
| *** 668,669 **** |
| --- 673,676 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 305, |
| /**/ |
| |
| -- |
| OLD WOMAN: Well, how did you become king, then? |
| ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite, |
| held Excalibur aloft from the bosom of the water to signify by Divine |
| Providence ... that I, Arthur, was to carry Excalibur ... That is |
| why I am your king! |
| "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ download, build and distribute -- http://www.A-A-P.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |