summaryrefslogtreecommitdiff
path: root/textproc/groff/patches/patch-ae
blob: 50b91c065c8e4abe0cbd0eb2109be8f0bc6b4f0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
$NetBSD: patch-ae,v 1.2 2009/02/24 20:41:46 wiz Exp $

--- tmac/troffrc.orig	2009-01-09 14:25:52.000000000 +0000
+++ tmac/troffrc
@@ -44,6 +44,61 @@ troffrc!X100 troffrc!X100-12 troffrc!lj4
 .\" Handle paper formats.
 .do mso papersize.tmac
 .
+.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 sgr@dummy
+.  .
+.
+.  rn wh wh@old
+.
+.  \" 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 no@sgr
+.    if \\n[.P] \{\
+.      if (\\n[.t] == \\n[.p]) \{\
+.        rn wh@old wh
+.        rm no@sgr
+.        wh 0
+.        sp \\n[.trunc]
+.        nop \X'tty: sgr 0'
+.        sp -1
+.    \}\}
+.  .
+.
+.  wh@old 0 no@sgr
+.
+.  \" The piggyback version to be appended to macros planted with the
+.  \" modified `wh' request.
+.  de1 no@sgr1
+.    if \\n[.P] \{\
+.      rn wh@old wh
+.      ds no@sgr1
+.      nop \X'tty: sgr 0'
+.      sp -1
+.    \}
+.  .
+.
+.  \" We redefine the `wh' request so that `no@sgr1' is appended to
+.  \" the trap macro.
+.  de1 wh
+.    am1 \\$2 sgr@dummy
+.      no@sgr1
+.    sgr@dummy
+.    wh@old \\$1 \\$2
+.  .
+.
+.  cp \n[_C]
+.\}
+.
 .\" Handle PS images.
 .do mso pspic.tmac
 .