nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] colorized/highlighted scan output?

2012-11-02 12:18:20
So I've been thinking about this overnight and looking at some things
this morning, and I'm not sure what the right answer is.

First off, let's start with Paul Fox's comment yesterday:

the 1980's just called.  they want their termcap file back.

Ouch. :-)  Okay, I know that was all in good fun, and I'm not offended.
Paul makes a good point; why are we requiring users to put raw escapes in
their format files?  Can't we use curses/termcap/terminfo for that?

So I took at look at that.  Here's my understanding of the way things
are:

- Can we use curses?  Short answer: no.

  Longer answer: the format strings are compiled internally and passed up
  to programs like scan and the like for them to handle (scan just prints
  the output of the format string to stdout, other programs do things like
  write them to a file).

  curses, however, wants to handle all of the output itself; it wants
  a descriptor for the output terminal and it handles all of the I/O.
  It treats the output terminal as a "screen" and handles it that way.
  That doesn't seem like the right fit with format; maybe you could do
  it, but it would require a whole lot of readjustment of scan and that's
  more than I want to do (and more than I think is reasonable).

- Can we use terminfo?  Short answer: maybe.

  My gut feeling is that terminfo seems to be what people have converged
  to using.  It's not apparant at first glance how you translate a terminfo
  capability to the actual output characters, but let's assume it's
  possible (hm, looks like what you do is tparm()/tputs()).  So that
  would mean we'd have to add a fair number of format functions that
  would do the various terminfo stuff, but maybe that wouldn't be so
  bad.  If we handle this in fmt_compile, it might not even be that
  many new format instructions (perhaps only one that means "output this
  without adding to width").

- Can we just stick with the original idea of outputting escape characters?

  Well ... maybe.  The problem is the limitation of the format language.
  For example, you can't have an argument to a function which contains
  a ')' character.  Maybe that isn't a concern.  We might need two new
  format functions, ones that turn "zero width" mode on and off (and
  thus two new format instructions).

So what do others think?

--Ken

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>