Skip to content

Commit

Permalink
file names containing -r do not trigger colorizing
Browse files Browse the repository at this point in the history
  • Loading branch information
wofr06 committed Feb 21, 2022
1 parent bc97074 commit b8c644b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lesspipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,10 @@ analyze_args () {
# return if we want to watch growing files
[[ $lessarg == *less\ *\ +F\ * || $lessarg == *less\ *\ : ]] && exit 0
# color is set when calling less with -r or -R or LESS contains that option
lessarg="$LESS $lessarg"
lessarg=`echo $lessarg|sed 's/-[a-zA-Z]*[rR]/-r/'`
lessarg="l $LESS $lessarg"
lessarg=`echo $lessarg|sed 's/ -[a-zA-Z]*[rR]/ -r/'`
has_cmd tput && colors=$(tput colors) || colors=0
if [[ $colors -ge 8 && $lessarg == *-[rR]* ]]; then
if [[ $colors -ge 8 && $lessarg == *\ -[rR]* ]]; then
COLOR="--color=always"
else
COLOR="--color=auto"
Expand Down
4 changes: 4 additions & 0 deletions test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ sub comp {
diff -u $T/tests/t.eclass $T/tests/test.c|less - :diff # unified diff piped through less works git #11
c test=a
### github issues (solved and unsolved) and other test cases
less $T/tests/a-r-R.pl # do not call vimcolor with -l extension git #77
c sub
LESS= less $T/tests/a-r-R.pl # name contains -r or -R git #78
= sub test {}
less $T/tests/test_zip:non-existent-file # nonexisting file in a zip archive git issue #1
=
less $T/tests/test\ \;\'\"\[\(\{ok # file name with chars such as ", ' ...
Expand Down
Binary file modified tests/special.tgz
Binary file not shown.

0 comments on commit b8c644b

Please sign in to comment.