bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #61561] [grotty] 'sgr' device control command takes effect only at


From: G. Branden Robinson
Subject: [bug #61561] [grotty] 'sgr' device control command takes effect only at page breaks
Date: Fri, 26 Nov 2021 18:38:57 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #7, bug #61561 (project groff):

Whoops.  I made an error.  The think I thought I could break, doesn't break. 
That's good.  But my other points stand.

Here's the wrong part.

[comment #6 comment #6:]
> It occurs to me that you could break this by enabling SGR (the default),
going nuts with SGR character attributes, and then contriving to disable SGR
in the midst of the page, which, as we've seen, won't actually turn anything
off in the terminal.  When the page bottom is hit, all the logic that cleans
up character attribute state will be skipped, because you're in nice, clean
legacy output mode.  Let's see.
> 
> Input:
> 
> $ cat EXPERIMENTS/grotty-make-a-mess.groff
> .fcolor magenta
> .gcolor white
> .ft BI
> obnoxious\X'tty: sgr'
> .bp
> still obnoxious\[em]ha ha ha
> 

I forgot to put a (space and) '0' after the 'sgr' above, so I didn't actually
do anything at all.  My brain itched momentarily regarding why I got only
_one_ debugging output diagnostic instead of two, but I didn't pay attention.

> Yup.

Nope.  :P

> In other words, most of the logic quoted above should have been moved into
`update_options()` or, even better, its own function, called from  there _and_
`end_page()`.

Terminal output would have to be refactored to handle this.  grotty(1) really
outputs a page at a time instead of a line at a time, which changes the
analysis a bit.

If we look earlier in `end_page()`, we see this.


 750   for (int i = 0; i < last_line; i++) {                                 
 751     tty_glyph *p = lines[i];                                            
 752     lines[i] = 0;                                                       
 753     tty_glyph *g = 0;                                                   
 754     while (p) {                                                         
 755       tty_glyph *tem = p->next;                                         
 756       p->next = g;                                                      
 757       g = p;                                                            
 758       p = tem;                                                          
 759     }                                                                   


...and then a whole bunch more logic to format the output with the currently
configured text attributes.

Like I said, this doesn't change much.  But I incorrectly deduced that
grotty(1) has for 20 years been susceptible to the SGR-switching tomfoolery I
attempted in the quoted comment--it has not been.

Sadly grotty(1)'s page-at-a-time approach to output is nowhere documented; it
might explain the otherwise mysterious claims sprinkled around our Texinfo
manual and maybe some other places that GNU nroff can't be used interactively
as Unix nroff could (`.rd` again).  Even that claim is too strong--a while
back I updated groff(1) to illustrate how you can run groff -T utf8 as a REPL
and I've used it that way frequently since I started participating in its
development.

Page-at-a-time layout even for terminal devices is indeed more consistent with
troff and reflects the grand unification strategy that GNU roff undertook in
the first place.  It's not clear to me exactly what was lost.  It would be
nice to have a model document that works under Unix nroff but not GNU troff as
a result of this change.

Okay, I need to stop procrastinating and read some ncurses man pages...       
                        




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61561>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]