=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/term.c,v retrieving revision 1.65 retrieving revision 1.66 diff -c -r1.65 -r1.66 *** src/usr.bin/mandoc/term.c 2012/07/10 15:33:40 1.65 --- src/usr.bin/mandoc/term.c 2012/07/16 21:28:12 1.66 *************** *** 1,4 **** ! /* $Id: term.c,v 1.65 2012/07/10 15:33:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2011, 2012 Ingo Schwarze --- 1,4 ---- ! /* $Id: term.c,v 1.66 2012/07/16 21:28:12 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2011, 2012 Ingo Schwarze *************** *** 102,107 **** --- 102,108 ---- term_flushln(struct termp *p) { int i; /* current input position in p->buf */ + int ntab; /* number of tabs to prepend */ size_t vis; /* current visual position on output */ size_t vbl; /* number of blanks to prepend to output */ size_t vend; /* end of word visual position on output */ *************** *** 140,149 **** --- 141,152 ---- * Handle literal tab characters: collapse all * subsequent tabs into a single huge set of spaces. */ + ntab = 0; while (i < p->col && '\t' == p->buf[i]) { vend = (vis / p->tabwidth + 1) * p->tabwidth; vbl += vend - vis; vis = vend; + ntab++; i++; } *************** *** 187,192 **** --- 190,200 ---- vend += p->rmargin - p->offset; } else vbl = p->offset; + + /* use pending tabs on the new line */ + + if (0 < ntab) + vbl += ntab * p->tabwidth; /* Remove the p->overstep width. */