aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-05-30 16:31:29 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-05-30 16:31:29 +0000
commitb85deb01cef03da6ed5386c5a24881bbba2216b2 (patch)
treea2f50414c87131ab5b6592957a8e8f665f938e52 /mdoc_term.c
parenta20be95dec7797c55257792a32b6b39bdbdfe595 (diff)
downloadmandoc-b85deb01cef03da6ed5386c5a24881bbba2216b2.tar.gz
mandoc-b85deb01cef03da6ed5386c5a24881bbba2216b2.tar.zst
mandoc-b85deb01cef03da6ed5386c5a24881bbba2216b2.zip
fix formatting of intermediate punctuation in .Lk
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index e4c0b92c..382804d5 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.357 2017/05/09 14:10:01 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.358 2017/05/30 16:31:29 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -1977,16 +1977,24 @@ termp_li_pre(DECL_ARGS)
static int
termp_lk_pre(DECL_ARGS)
{
- const struct roff_node *link, *descr;
+ const struct roff_node *link, *descr, *punct;
int display;
if ((link = n->child) == NULL)
return 0;
+ /* Find beginning of trailing punctuation. */
+ punct = n->last;
+ while (punct != link && punct->flags & NODE_DELIMC)
+ punct = punct->prev;
+ punct = punct->next;
+
/* Link text. */
- if ((descr = link->next) != NULL && !(descr->flags & NODE_DELIMC)) {
+ if ((descr = link->next) != NULL && descr != punct) {
term_fontpush(p, TERMFONT_UNDER);
- while (descr != NULL && !(descr->flags & NODE_DELIMC)) {
+ while (descr != punct) {
+ if (descr->flags & (NODE_DELIMC | NODE_DELIMO))
+ p->flags |= TERMP_NOSPACE;
term_word(p, descr->string);
descr = descr->next;
}
@@ -2006,10 +2014,10 @@ termp_lk_pre(DECL_ARGS)
term_fontpop(p);
/* Trailing punctuation. */
- while (descr != NULL) {
+ while (punct != NULL) {
p->flags |= TERMP_NOSPACE;
- term_word(p, descr->string);
- descr = descr->next;
+ term_word(p, punct->string);
+ punct = punct->next;
}
if (display)
term_newln(p);