summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/roff_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-06-04 22:43:51 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-06-04 22:43:51 +0000
commite84e04910f53da838fd294bc4831a011dae384e4 (patch)
tree368d20ee298991376cfbfa1e3af6a38e5a8abd1a /usr.bin/mandoc/roff_term.c
parentdcea9039c6ced84af84f198a307afb38ac108fd1 (diff)
Implement the roff(7) .mc (right margin character) request.
The Tcl/Tk manual pages use this extensively. Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf; instead, implement a proper TERMP_BRNEVER flag.
Diffstat (limited to 'usr.bin/mandoc/roff_term.c')
-rw-r--r--usr.bin/mandoc/roff_term.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/usr.bin/mandoc/roff_term.c b/usr.bin/mandoc/roff_term.c
index 4d5b50ff47b..7f15f3cfa80 100644
--- a/usr.bin/mandoc/roff_term.c
+++ b/usr.bin/mandoc/roff_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff_term.c,v 1.6 2017/05/08 15:33:43 schwarze Exp $ */
+/* $OpenBSD: roff_term.c,v 1.7 2017/06/04 22:43:50 schwarze Exp $ */
/*
* Copyright (c) 2010, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -30,6 +30,7 @@ typedef void (*roff_term_pre_fp)(ROFF_TERM_ARGS);
static void roff_term_pre_br(ROFF_TERM_ARGS);
static void roff_term_pre_ft(ROFF_TERM_ARGS);
static void roff_term_pre_ll(ROFF_TERM_ARGS);
+static void roff_term_pre_mc(ROFF_TERM_ARGS);
static void roff_term_pre_sp(ROFF_TERM_ARGS);
static void roff_term_pre_ta(ROFF_TERM_ARGS);
static void roff_term_pre_ti(ROFF_TERM_ARGS);
@@ -37,7 +38,8 @@ static void roff_term_pre_ti(ROFF_TERM_ARGS);
static const roff_term_pre_fp roff_term_pre_acts[ROFF_MAX] = {
roff_term_pre_br, /* br */
roff_term_pre_ft, /* ft */
- roff_term_pre_ll, /* ft */
+ roff_term_pre_ll, /* ll */
+ roff_term_pre_mc, /* mc */
roff_term_pre_sp, /* sp */
roff_term_pre_ta, /* ta */
roff_term_pre_ti, /* ti */
@@ -95,6 +97,21 @@ roff_term_pre_ll(ROFF_TERM_ARGS)
}
static void
+roff_term_pre_mc(ROFF_TERM_ARGS)
+{
+ if (p->col) {
+ p->flags |= TERMP_NOBREAK;
+ term_flushln(p);
+ p->flags &= ~(TERMP_NOBREAK | TERMP_NOSPACE);
+ }
+ if (n->child != NULL) {
+ p->mc = n->child->string;
+ p->flags |= TERMP_NEWMC;
+ } else
+ p->flags |= TERMP_ENDMC;
+}
+
+static void
roff_term_pre_sp(ROFF_TERM_ARGS)
{
struct roffsu su;