From 735c1e543343b638b339077b91a5874260cdf14b Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 2 Apr 2020 15:04:36 +0000 Subject: Copy tagged strings before marking hyphens as breakable. For example, this makes ":tCo-processes" work in ksh(1). --- mdoc_validate.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'mdoc_validate.c') diff --git a/mdoc_validate.c b/mdoc_validate.c index ad096588..551dec25 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.381 2020/04/01 20:21:08 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.382 2020/04/02 15:04:36 schwarze Exp $ */ /* * Copyright (c) 2010-2020 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons @@ -2164,10 +2164,11 @@ post_rs(POST_ARGS) static void post_hyph(POST_ARGS) { - struct roff_node *nch; + struct roff_node *n, *nch; char *cp; - for (nch = mdoc->last->child; nch != NULL; nch = nch->next) { + n = mdoc->last; + for (nch = n->child; nch != NULL; nch = nch->next) { if (nch->type != ROFFT_TEXT) continue; cp = nch->string; @@ -2176,8 +2177,11 @@ post_hyph(POST_ARGS) while (*(++cp) != '\0') if (*cp == '-' && isalpha((unsigned char)cp[-1]) && - isalpha((unsigned char)cp[1])) + isalpha((unsigned char)cp[1])) { + if (n->string == NULL && n->flags & NODE_ID) + n->string = mandoc_strdup(nch->string); *cp = ASCII_HYPH; + } } } -- cgit v1.2.3