Ticket #2976: magic mode is broken in mcview.
commitb8208b0514e7290fa9301f67bcfebdb4a541bc2e
authorGergely Szász <szaszg@hu.inter.net>
Sat, 9 Mar 2013 06:14:22 +0000 (9 10:14 +0400)
committerAndrew Borodin <aborodin@vmail.ru>
Wed, 20 Mar 2013 13:01:38 +0000 (20 17:01 +0400)
tree9d95dbb5da6be0f4c6956a253063bebaf3c2cfe2
parent51a6273fb842b65ade14082649e855a52abdc14e
Ticket #2976: magic mode is broken in mcview.

The bug:
  If we open a file with F3 from panels, then mc uses "file extension"
  style open (e.g. archive.sh) and Format/Raw switching is O.K.

  If we open file in "Raw" mode, or use quick view, mc opens files
  without "file extension" helpers. Format/Raw switching is broken.

  In mcview_load() we check magic_mode and detect "compressed" files.
  If magic mode is on and file is "compressed" we free the current vpath
  and generate a new vpath with "decompress magic", but nothing else.
  So, the file name disappear and we see the raw content.
  After user press F8, mcview reloads the file. Now filename is the "new"
  magic filename. mcview_load() open the file with the decompress "helper"
  (using sfs). We see the uncompressed (parsed) content.
  After user press F8, nothing happend, because original file name is lost.

The solution:
  Remove the old vpath destruction.
  Open the file with "uncopress magic" if magic_mode is on and file is
  "compressed".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
src/viewer/mcviewer.c