aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-04 22:44:15 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-04 22:44:15 +0000
commit4a4657f9f40ea60d08ecfb7c12fc46e29440ff58 (patch)
treebf7ff7d4e63bcc15048ba4c11abf99b9146c1e76 /man_term.c
parentab795e726e781905db61f736dacb3fbb0e35a301 (diff)
downloadmandoc-4a4657f9f40ea60d08ecfb7c12fc46e29440ff58.tar.gz
mandoc-4a4657f9f40ea60d08ecfb7c12fc46e29440ff58.tar.zst
mandoc-4a4657f9f40ea60d08ecfb7c12fc46e29440ff58.zip
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 'man_term.c')
-rw-r--r--man_term.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/man_term.c b/man_term.c
index a32213fb..6a4987a4 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.201 2017/06/04 18:50:35 schwarze Exp $ */
+/* $Id: man_term.c,v 1.202 2017/06/04 22:44:15 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -862,7 +862,6 @@ post_UR(DECL_ARGS)
static void
print_man_node(DECL_ARGS)
{
- size_t rm, rmax;
int c;
switch (n->type) {
@@ -930,20 +929,16 @@ out:
if (mt->fl & MANT_LITERAL &&
! (p->flags & (TERMP_NOBREAK | TERMP_NONEWLINE)) &&
(n->next == NULL || n->next->flags & NODE_LINE)) {
- rm = p->rmargin;
- rmax = p->maxrmargin;
- p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
- p->flags |= TERMP_NOSPACE;
+ p->flags |= TERMP_BRNEVER | TERMP_NOSPACE;
if (n->string != NULL && *n->string != '\0')
term_flushln(p);
else
term_newln(p);
- if (rm < rmax && n->parent->tok == MAN_HP) {
- p->offset = rm;
- p->rmargin = rmax;
- } else
- p->rmargin = rm;
- p->maxrmargin = rmax;
+ p->flags &= ~TERMP_BRNEVER;
+ if (p->rmargin < p->maxrmargin && n->parent->tok == MAN_HP) {
+ p->offset = p->rmargin;
+ p->rmargin = p->maxrmargin;
+ }
}
if (NODE_EOS & n->flags)
p->flags |= TERMP_SENTENCE;