delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/29/01:46:11

Date: Wed, 27 Sep 2000 23:09:48 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: wp AT sensotech DOT at
Message-Id: <9743-Wed27Sep2000230948+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.2.emacs20_6 I) and Blat ver 1.8.5h
CC: djgpp AT delorie DOT com
In-reply-to: <8qtbhg$5mt$1@nets3.rz.RWTH-Aachen.DE> (message from
Hans-Bernhard Broeker on 27 Sep 2000 17:42:08 GMT)
Subject: Re: How can I get colors from ls to less
References: <39D227C4 DOT 17D0A441 AT sensotech DOT at> <8qtbhg$5mt$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
> Newsgroups: comp.os.msdos.djgpp
> Date: 27 Sep 2000 17:42:08 GMT
> 
> > The first part gives me nice colored output as expected, but 'less' does
> > not display colors anymore. Instead it displays the escape characters
> > like ESC[00m_bashrcESC[00m.
> 
> The key reason for this is that 'less' doesn't generally trust arbitrary
> files to be displayable without causing some mayhem to the terminal
> (making it unusable until reboot, or whatever) --- it's its Unix legacy
> shining through, here.
> 
> That's why it will display Escape sequance literally, rather than just
> executing them. You can switch that off by typing
> 
> -r<Return>

It won't help: Less doesn't ``execute'' escape sequences, that is, it
doesn't convert them to color commands.  Instead, it uses direct video
writes (the conio functions) to display colored text, but only if the
original text includes bold and underlined characters simulated by
backspace-overstrike method.  Escape sequences are handled as simple
non-printable characters.

> If that still doesn't work, that would mean 'less' doesn't have the
> terminal escape sequence treatment built into it that 'ls' and 'bash'
> have

Exactly: Less doesn't have (and doesn't need to have) the code which
emulates an ANSI console driver.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019