diff options
| author | 2017-07-06 00:08:52 +0000 | |
|---|---|---|
| committer | 2017-07-06 00:08:52 +0000 | |
| commit | 2fe51f68b9b718c29473d59374e280deed8665e5 (patch) | |
| tree | 62e4b34dbb6accd9176d33a1f152451ab2552a9d /usr.bin/mandoc/eqn_term.c | |
| parent | Fix native/raw backlight support in inteldrm(4). (diff) | |
| download | wireguard-openbsd-2fe51f68b9b718c29473d59374e280deed8665e5.tar.xz wireguard-openbsd-2fe51f68b9b718c29473d59374e280deed8665e5.zip | |
Fix operator precedence according to Brian W. Kernighan and Lorinda
L. Cherry, "Typesetting Mathematics - User's Guide (Second Edition)",
August 15, 1978, paragraph 23; swarm of bugs pointed out by bentley@.
Diffstat (limited to 'usr.bin/mandoc/eqn_term.c')
| -rw-r--r-- | usr.bin/mandoc/eqn_term.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/usr.bin/mandoc/eqn_term.c b/usr.bin/mandoc/eqn_term.c index f41bc1d4129..503919fdbf8 100644 --- a/usr.bin/mandoc/eqn_term.c +++ b/usr.bin/mandoc/eqn_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eqn_term.c,v 1.6 2017/07/05 15:03:20 schwarze Exp $ */ +/* $OpenBSD: eqn_term.c,v 1.7 2017/07/06 00:08:52 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -111,15 +111,6 @@ eqn_box(struct termp *p, const struct eqn_box *bp) if (bp->font != EQNFONT_NONE) term_fontpop(p); - if ((bp->type == EQN_LIST && bp->expectargs > 1) || - (bp->type == EQN_PILE && (bp->prev || bp->next)) || - (bp->parent != NULL && bp->parent->pos == EQNPOS_SQRT)) { - p->flags |= TERMP_NOSPACE; - term_word(p, bp->right != NULL ? bp->right : ")"); - if (bp->parent->type == EQN_SUBEXPR && bp->next != NULL) - p->flags |= TERMP_NOSPACE; - } - if (bp->top != NULL) { p->flags |= TERMP_NOSPACE; term_word(p, bp->top); @@ -128,4 +119,12 @@ eqn_box(struct termp *p, const struct eqn_box *bp) p->flags |= TERMP_NOSPACE; term_word(p, "_"); } + if ((bp->type == EQN_LIST && bp->expectargs > 1) || + (bp->type == EQN_PILE && (bp->prev || bp->next)) || + (bp->parent != NULL && bp->parent->pos == EQNPOS_SQRT)) { + p->flags |= TERMP_NOSPACE; + term_word(p, bp->right != NULL ? bp->right : ")"); + if (bp->parent->type == EQN_SUBEXPR && bp->next != NULL) + p->flags |= TERMP_NOSPACE; + } } |
