david wrote:
 > Hi,
 > 
 > I tried adding some raw ANSI escape sequences to a scan
 > format to colorize the cur and unseen messages, and they
 > sort of work.  I get the desired effects, but scan loses
 > track of how many characters are actually displayed so there
 > are some annoyances.  They should be easy to fix.
 > 
 > But before I dig into that, does anyone have another way to
 > colorize or highlight the output from scan?

i think my usual inclination for colorization is to post-process
with sed.  i haven't done it with scan output, but i do it
with a couple of different mail perusing scripts i've written.

leaving out the details, something like this:

    color_init()
    {
        RED="$(printf \\033[1\;31m)"
        GREEN="$(printf \\033[1\;32m)"
        YELLOW="$(printf \\033[1\;33m)"
        BLUE="$(printf \\033[1\;34m)"
        PURPLE="$(printf \\033[1\;35m)"
        CYAN="$(printf \\033[1\;36m)"
        BOLD="$(printf \\033[1m)"
        NORMAL="$(printf \\033[m)"
        ESC="$(printf \\033)"
    }

    # make the Subject: and From: text stand out in red and blue
    colorize()
    {
        sed \
            -e 's/^\(Subject: *\)\(.*\)/\1'"$RED"'\2'"$NORMAL"'/' \
            -e 's/^\(From: *\)\(.*\)/\1'"$BLUE"'\2'"$NORMAL"'/'
    }

    mhshow $msg | colorize

i guess you'd have to use a scan format which tagged the line,
and then sed might have to untag them as well as colorize them.

paul
=---------------------
 paul fox, [email protected] (arlington, ma, where it's 44.2 degrees)

_______________________________________________
Nmh-workers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/nmh-workers

Reply via email to