]> git.pld-linux.org Git - packages/lesspipe.git/commitdiff
- check if less would parse escape sequences as colors, either by
authorTomasz Pala <gotar@pld-linux.org>
Thu, 28 May 2009 10:51:38 +0000 (10:51 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
  LESS environment variable having -?[rR] (note: doesn't have to be separate
word, there might be false positive test results), or
  less itself having -[rR] switch (note2: only before first non-option
argument, so some false positives possible too)
  Skip highlight(ing) when it wouldn't interpret them.

Changed files:
    lesspipe.sh -> 1.39

lesspipe.sh

index db943abf9d3437d46df21580ae6bac0a41e23cf0..8dbbddd90750b9dcc54c8d7f24c4ba4286835853 100644 (file)
@@ -82,7 +82,8 @@ lesspipe() {
                xterm|xterm-color)      output=xterm256;;
                *)                      output=ansi;;
           esac
-               run-mailcap "$1" || highlight --$output --style=darkblue "$1"
+               run-mailcap "$1" || \
+               { echo $LESS | grep -qi r || ps -p `ps -p $PPID -oppid=` -oargs= | grep -qiw -- -r && highlight --$output --style=darkblue "$1"; }
        # Check to see if binary, if so -- view with 'strings'
        # FILE=$(file -L "$1")
        esac
This page took 0.09936 seconds and 4 git commands to generate.