=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/term.c,v retrieving revision 1.138 retrieving revision 1.139 diff -c -r1.138 -r1.139 *** src/usr.bin/mandoc/term.c 2019/01/03 19:59:11 1.138 --- src/usr.bin/mandoc/term.c 2019/01/04 03:20:44 1.139 *************** *** 1,4 **** ! /* $OpenBSD: term.c,v 1.138 2019/01/03 19:59:11 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2019 Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: term.c,v 1.139 2019/01/04 03:20:44 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2019 Ingo Schwarze *************** *** 133,144 **** /* * Figure out how much text will fit in the field. * If there is whitespace only, print nothing. - * Otherwise, print the field content. */ term_fill(p, &nbr, &vbr, vtarget); if (nbr == 0) break; term_field(p, vbl, nbr, vbr, vtarget); --- 133,158 ---- /* * Figure out how much text will fit in the field. * If there is whitespace only, print nothing. */ term_fill(p, &nbr, &vbr, vtarget); if (nbr == 0) break; + + /* + * With the CENTER or RIGHT flag, increase the indentation + * to center the text between the left and right margins + * or to adjust it to the right margin, respectively. + */ + + if (vbr < vtarget) { + if (p->flags & TERMP_CENTER) + vbl += (vtarget - vbr) / 2; + else if (p->flags & TERMP_RIGHT) + vbl += vtarget - vbr; + } + + /* Finally, print the field content. */ term_field(p, vbl, nbr, vbr, vtarget);