[22] in bug-owl

home help back first fref pref prev next nref lref last post

owl (color and a few misc comments)

daemon@ATHENA.MIT.EDU (Jeremy Daniel)
Mon Jun 24 14:10:32 2002

To: bug-ktools@MIT.EDU
From: Jeremy Daniel <jdaniel@MIT.EDU>
Date: 17 Jun 2002 04:51:20 -0400
Message-ID: <skeadpuffuf.fsf@multics.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Resent-To: bug-owl-mtg@spatula-city.mit.edu
Resent-From: "James M. Kretchmar" <kretch@MIT.EDU>

* The "Not logged in or subscribing to messages." thing doesn't tell
  you _which_ of the users on a multiple recipient zephyr are not
  logged in

* C-l doesn't actually redraw the screen in most cases, resizeing the
  terminal does a much better job, or sometimes making and the closing
  a popup and then going up or down to a different message.

* I've developed a color patch for owl, here's my comments file:
  I put together a patchfile in /mit/jdaniel/project/owl/owl-1.1.1-color.patch  
  if you care to use it for anything.
----------
I've mostly finished a color patch to owl.  The files are all in
/mit/jdaniel/project/owl/owl-1.1.1-color/ with README-COLOR containing
these comments.  I put most of the new code in color.c, but there are
also definitions in owl.h, an init function called from owl.c, and
substantial changes to fmtext.c.

It currently understands @color{NAME} where NAME must be one of black,
red, green, yellow, blue, magenta, cyan, white.  Since zwgc really
contains no idiom for setting backgrounds on a per character basis I
came up with @bgcolor(NAME), which accepts the same values.  Any color
it doesn't understand should be printed as before, and any
non-readable color such as an attempt to set foreground to green
within a green background region will also print literally.  These can
of course be used in a format section in .owlconf to color messages
according to the user's preferences.

The version I have built here is for sun, and I can't get it to do
anything interesting unless I run it with a TERM value that knows it
has colors.  The best one I've found for this is "dtterm" (thanks
mitchb), but this one only seems to do the basic fg on black colors (I
suspect it has a limit of 8 pairs).  Alternatively you can use
"sun-color" to see all of them, but that deals poorly with redraws,
and I wasn't sure how to change owl_function_full_redisplay() to fix
that.  If there are other terminal possibilities I should try please
recommend them.

The definitions added to owl.h were all of the form OWL_COLOR_*.  Also
of note is the addition of *color to struct owl_fmtext.  My first
version of the code changed *fmbuff to an unsigned short, but I
decided adding a new element to the struct was cleaner when I rewrote
the second time.  There are only 64 possible color pairs, so the color
attribute is only using 6 bits.  A single color (as returned by
owl_parse_color_name()) however needs 4 bits, one of which is to
distinguish black from an unparseable color.

I made substantial changes to owl_fmtext_curs_waddstr() which I think
make it much easier to follow what it's actually doing.  I also made a
few minor changes to the codepath in owl_fmtext_append_ztext().  Most
notably moving buff outside the loop to save code mallocing and
freeing it.  I replaced strcmp() with strcasecmp() since man zwgc
documents @ expressions to be case insensitive.  In addition to
@color() and @bgcolor() I also added matching of @beep() and @(empty
command).  Any command not matched now creates an environment whose
only difference is that it's bracket will be printed.  chrpstack[]
tracks this and colorstack[] was created to track colors.

Please send me any comments on this code, I'd be happy to make any
changes you feel necessary before accepting the patch.

Here's a sample color zephyr to see how it comes out:
@color(red)o@color(green)w@color(yellow)l@color(blue)-
@color(magenta)c@color(cyan)o@bgcolor(red)l@color(black)o@color(green)r
----------
-- 


				Jer


------------------------------------------------------------------
Tulgey Wood - tulgeywood@attbi.com     Cell Phone: 617-429-8573 / 
4 Farragut Ave (617-629-3983)             jdaniel-phone@mit.edu
Somerville, MA 02144-1709              AIM: jdanielmit      
                                    
Zephyr athena users over the web:  http://webzephyr.mit.edu/

home help back first fref pref prev next nref lref last post