wofr06 / lesspipe

lesspipe - display more with less
GNU General Public License v2.0
484 stars 51 forks source link

zip file listing output includes color escape codes when color is not enabled #140

Closed pimlottc closed 10 months ago

pimlottc commented 10 months ago

I just installed lesspipe 2.10 on macOS via homebrew and set the LESSOPEN variable as recommended by the installation instructions:

% export | grep LESS
LESSOPEN='|/opt/homebrew/bin/lesspipe.sh %s'

I did not set any options for colored output, but when I view a zip file to see the file listing, I see escape codes.

Steps to reproduce:

  1. Create a zip file containing a directory: mkdir -p dir && zip dir.zip dir
  2. View with less pipe: less dir.zip

Expected output:

==> (lesspipe 2.10) use zip_file:contained_file to view a file in the archive
drwxr-xr-x  0 502    20          0 Dec 12 11:15 dir/
dir.zip (END)

Actual output:

==> (lesspipe 2.10) use zip_file:contained_file to view a file in the archive
drwxr-xr-x  0 502    20          0 Dec 12 11:15 ESC[01;34mdir/ESC[0m
dir.zip (END)
pimlottc commented 10 months ago

From my reading of the docs, the output of lesspipe should only include colored output when LESS has been set correctly

Syntax highlighting and other methods of colorizing the output is only activated if the environment variable LESS is existing and contains the option -R (or -r) or less is called with one of these options.

wofr06 commented 10 months ago

For archives the archive_color script was called unconditionally. That has been fixed now.

pimlottc commented 10 months ago

Thank you! Working properly now in 2.11