groff
[Top][All Lists]
Advanced

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

[Groff] Re: Disabling SGR in grotty(1): gory details


From: Werner LEMBERG
Subject: [Groff] Re: Disabling SGR in grotty(1): gory details
Date: Wed, 30 Oct 2002 18:15:25 +0100 (CET)

Here a new and improved version of my trap solution for Ruslan's
problem.  To use it reliably, you should upgrade to the latest CVS
version of groff which fixes a bug in the computation of the .trunc
register (a top-of-page macro always set it to zero previously).


    Werner

======================================================================

.if n \{\
.  nr _C \n(.C
.  cp 0
.
.  \" The following code sets a top-of-page trap to disable grotty's TTY
.  \" mode.  Since neither \X nor .output can be used before the first
.  \" page has started, we must use a trap.  To make it work with troff's
.  \" -o option, we wait until the first printed page.
.
.  de address@hidden
.  .
.
.  rn wh address@hidden
.
.  \" The stand-alone version.  If no other trap is set, we can safely
.  \" insert the truncated vertical space caused by the trap (if any).
.  \" Otherwise we assume that the document's main macro package takes
.  \" care of that.  As soon as the trap has been executed, it is removed.
.  de1 address@hidden
.    if \\n[.P] \{\
.      if (\\n[.t] == \\n[.p]) \{\
.        rn address@hidden wh
.        rm address@hidden
.        wh 0
.        sp \\n[.trunc]
.        nop \X'tty: sgr 0'
.        sp -1
.    \}\}
.  .
.
.  address@hidden 0 address@hidden
.
.  \" The piggyback version to be appended to macros planted with the
.  \" modified `wh' request.
.  de1 address@hidden
.    if \\n[.P] \{\
.      rn address@hidden wh
.      ds address@hidden
.      nop \X'tty: sgr 0'
.      sp -1
.    \}
.  .
.
.  \" We redefine the `wh' request so that address@hidden' is appended to
.  \" the trap macro.
.  de1 wh
.    am1 \\$2 address@hidden
.      address@hidden
.    address@hidden
.    address@hidden \\$1 \\$2
.  .
.
.  cp \n[_C]
.\}

reply via email to

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