summaryrefslogtreecommitdiffstats
path: root/runtime/autoload/gzip.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2007-05-10 16:56:30 +0000
committerBram Moolenaar <Bram@vim.org>2007-05-10 16:56:30 +0000
commitc1762ccb6f1e06daeb9e3af644384f2a33f8fd7f (patch)
tree70022a20ffa4ed75b811bfb86f9754ef65df6953 /runtime/autoload/gzip.vim
parentf1dc4965b51903f1235c4d1145c57ada40c517aa (diff)
updated for version 7.1b
Diffstat (limited to 'runtime/autoload/gzip.vim')
-rw-r--r--runtime/autoload/gzip.vim70
1 files changed, 42 insertions, 28 deletions
diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim
index cf20238c88..f7c97a6d43 100644
--- a/runtime/autoload/gzip.vim
+++ b/runtime/autoload/gzip.vim
@@ -1,6 +1,6 @@
" Vim autoload file for editing compressed files.
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2006 Oct 09
+" Last Change: 2007 May 10
" These functions are used by the gzip plugin.
@@ -63,6 +63,12 @@ fun gzip#read(cmd)
" set 'modifiable'
let ma_save = &ma
setlocal ma
+ " Reset 'foldenable', otherwise line numbers get adjusted.
+ if has("folding")
+ let fen_save = &fen
+ setlocal nofen
+ endif
+
" when filtering the whole buffer, it will become empty
let empty = line("'[") == 1 && line("']") == line("$")
let tmp = tempname()
@@ -74,42 +80,50 @@ fun gzip#read(cmd)
if !filereadable(tmp)
" uncompress didn't work! Keep the compressed file then.
echoerr "Error: Could not read uncompressed file"
- return
- endif
- " delete the compressed lines; remember the line number
- let l = line("'[") - 1
- if exists(":lockmarks")
- lockmarks '[,']d _
+ let ok = 0
else
- '[,']d _
- endif
- " read in the uncompressed lines "'[-1r tmp"
- " Use ++edit if the buffer was empty, keep the 'ff' and 'fenc' options.
- setlocal nobin
- if exists(":lockmarks")
- if empty
- execute "silent lockmarks " . l . "r ++edit " . tmp
+ let ok = 1
+ " delete the compressed lines; remember the line number
+ let l = line("'[") - 1
+ if exists(":lockmarks")
+ lockmarks '[,']d _
else
- execute "silent lockmarks " . l . "r " . tmp
+ '[,']d _
+ endif
+ " read in the uncompressed lines "'[-1r tmp"
+ " Use ++edit if the buffer was empty, keep the 'ff' and 'fenc' options.
+ 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
- else
- execute "silent " . l . "r " . tmp
- endif
- " if buffer became empty, delete trailing blank line
- if empty
- silent $delete _
- 1
+ " if buffer became empty, delete trailing blank line
+ if empty
+ silent $delete _
+ 1
+ endif
+ " delete the temp file and the used buffers
+ call delete(tmp)
+ silent! exe "bwipe " . tmp
+ silent! exe "bwipe " . tmpe
endif
- " delete the temp file and the used buffers
- call delete(tmp)
- silent! exe "bwipe " . tmp
- silent! exe "bwipe " . tmpe
+
+ " Restore saved option values.
let &pm = pm_save
let &cpo = cpo_save
let &l:ma = ma_save
+ if has("folding")
+ let &l:fen = fen_save
+ endif
+
" When uncompressed the whole buffer, do autocommands
- if empty
+ if ok && empty
if &verbose >= 8
execute "doau BufReadPost " . expand("%:r")
else