<<< Date Index >>>     <<< Thread Index >>>

Re: Coloring Incomplete Lines in Pager (was: Re: upgrade to 1.5.5.1 results in funky colorization)



On Fri, Jan 02, 2004 at 06:47:53PM -0500, Allister MacLeod wrote:
> On Fri, Jan 02, 2004 at 01:40:14PM -0500, David Yitzchak Cohen wrote:

> So every character has at least 3 extra bytes before it when you do
> that, right?  (^[0m)

The ^[[0m (4 bytes) comes after every character (to reset the terminal
color - not strictly necessary for all but the last character in a color
sequence, but my coloring library automatically inserts it at the end
of the string it's coloring and I'm too lazy to change it just to work
around a stupid bug in somebody else's code in the best possible way);
before each character comes a coloring sequence (^[[nm where n is the
two-digit octal color number).  This results in every character (all
colored characters - uncolored ones are passed through as-is) consuming
about 10 bytes in the "last mile" between my filter and the Mutt pager.

> Seems, at one level, a bit excessive..

Yes, it's rather excessive, but. . .

> But also, at a different level, quite pragmatic.

...but quite pragmatic, as it works around a bunch of stupid bugs (but not
all - I still see some stuff miscolored by the pager, anyway, but it's not
very often anymore) without causing too much collateral damage, since. . .

> And, after all, most
> people don't use 2400 baud modems anymore.

:-)

> Unfortunately, I haven't been spending much time tinkering with
> mutt-guile lately, or I might indeed be able to present a nice
> solution.  The problem is getting 2 or more colors within a single
> line in the pager?  Actually, now that I think of it, to solve it any
> other way than you have, the pager would have to be rewritten
> somewhat.

It's important to note that I haven't "solved" the problem.  _The_ problem
is that Mutt attempts to regenerate the ANSI escape sequences by itself
when allow_ansi is on (as opposed to simply letting the sequences through
as-is), and the Mutt pager does a rather half-assed job of figuring stuff
like that out, so it screws everything up.  I've simply made it far more
difficult for Mutt's pager to screw up by spelling out the color of every
single character (except the uncolored ones, of course - I mean, come
on, Mutt's pager isn't _that_ stupid, is it?) individually.  The amazing
thing is that Mutt's pager _still_ screws up every now and then!

> Ah well.. adding "rewrite pager" to my mutt-guile wishlist. :-)

I'm actually working on a different project, hoping to run w3m in the
background and intercept "interesting" keystrokes before they reach
it, instead passing them on to Mutt (and quitting w3m automatically).
Now that my IMAP lives even when Mutt's in suspended animation, I have
no particular need for Mutt's pager except for triggering message-hooks,
and I'm pretty sure I can get around that too.  (The only problem I'm
finding is that w3m open(2)s its controlling terminal directly as O_RDWR,
which is a bit of a snag, to put it mildly.)

 - Dave

-- 
Uncle Cosmo, why do they call this a word processor?
It's simple, Skyler.  You've seen what food processors do to food, right?

Please visit this link:
http://rotter.net/israel

Attachment: pgpDymZoMjgYW.pgp
Description: PGP signature