subethaedit/SubEthaEdit

[Feature Request] Transparently edit gzip'ed files

TinoDidriksen opened this issue · 3 comments

One of the really neat things jEdit and mcedit do, is allow transparent editing of gzip'ed files. They can open, edit, and save e.g. .xml.gz files and the user never needs to worry about the compression. In the case of mcedit, it can even handle .bz2 and .xz and others.

Please add similar transparent handling of compressed files to SEE.

Sounds like an interesting request. How did jEdit and mcedit choose the compression level? I personally would not like it to have a short edit blow up the file size significantly.

Good question - answer is apparently that they don't.

mcedit pipes through cmdline tools with default options: https://github.com/MidnightCommander/mc/blob/master/src/editor/edit.c#L127-L134

jEdit uses Java's GZIPOutputStream https://sourceforge.net/p/jedit/svn/HEAD/tree/jEdit/trunk/org/gjt/sp/jedit/bufferio/BufferSaveRequest.java#l200 which doesn't even look capable of taking a compression level.

In case of gzip, there’s a hint in the header

XFL (eXtra FLags)
            These flags are available for use by specific compression
            methods.  The "deflate" method (CM = 8) sets these flags as
            follows:

               XFL = 2 - compressor used maximum compression,
                         slowest algorithm
               XFL = 4 - compressor used fastest algorithm```

https://tools.ietf.org/html/rfc1952.html#section-2.2