diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-04 22:44:15 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-04 22:44:15 +0000 |
commit | 57a85465cebb415008468ba9f16a7668e9119051 (patch) | |
tree | d342974ea656a6dfa44886c5469b783de62b7078 /roff_term.c | |
parent | 68a2cb887c993621fe7b72e21517d6a260376003 (diff) | |
download | mandoc-57a85465cebb415008468ba9f16a7668e9119051.tar.gz |
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 'roff_term.c')
-rw-r--r-- | roff_term.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/roff_term.c b/roff_term.c index 3c2f24a9..22af42b0 100644 --- a/roff_term.c +++ b/roff_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD$ */ +/* $Id$ */ /* * 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; |