diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-06-26 11:04:27 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-06-26 11:04:27 +0000 |
commit | 1f7888a4adb2858dbe9d27a0464fce73c6a82f00 (patch) | |
tree | f1058c53d410e81ab8ca37de04b74127a1a48a42 /usr.bin | |
parent | ac6471426e7345fab152ac08acbaf4953fd0807c (diff) |
when splitting a composite word,
do not forget to close the inserted list box
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/eqn.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.bin/mandoc/eqn.c b/usr.bin/mandoc/eqn.c index 6b8bb9b3c5e..cf860f2c51c 100644 --- a/usr.bin/mandoc/eqn.c +++ b/usr.bin/mandoc/eqn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eqn.c,v 1.32 2017/06/23 21:04:34 schwarze Exp $ */ +/* $OpenBSD: eqn.c,v 1.33 2017/06/26 11:04:26 schwarze Exp $ */ /* * Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -720,7 +720,7 @@ static enum rofferr eqn_parse(struct eqn_node *ep, struct eqn_box *parent) { char sym[64]; - struct eqn_box *cur, *nbox; + struct eqn_box *cur, *nbox, *split; const char *cp, *cpn, *start; char *p; size_t sz; @@ -1116,6 +1116,7 @@ this_tok: break; cpn = p - 1; ccln = CCL_LET; + split = NULL; for (;;) { /* Advance to next character. */ cp = cpn++; @@ -1147,13 +1148,13 @@ this_tok: parent->last = cur->prev; parent->args--; /* Set up a list instead. */ - nbox = eqn_box_alloc(ep, parent); - nbox->type = EQN_LIST; + split = eqn_box_alloc(ep, parent); + split->type = EQN_LIST; /* Insert the word into the list. */ - nbox->first = nbox->last = cur; - cur->parent = nbox; + split->first = split->last = cur; + cur->parent = split; cur->prev = NULL; - parent = nbox; + parent = split; } /* Append a new text box. */ nbox = eqn_box_alloc(ep, parent); @@ -1170,6 +1171,8 @@ this_tok: cpn = p - 1; ccln = CCL_LET; } + if (split != NULL) + parent = split->parent; break; } /* |