diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2012-07-16 21:28:13 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2012-07-16 21:28:13 +0000 |
commit | 381c8430ddc78167d6951f6b75056aba939960a6 (patch) | |
tree | 27ac20214c5a3977ae729e12589e01035db8e600 /usr.bin | |
parent | bca5f39fa7184fce4d244be626a422477e4e4400 (diff) |
Release polishing: finally fix the perl(1) SYNOPSIS.
In flush-left mode of both man(7) and mdoc(7), when an output line is broken
at the position of a literal tab, the tab indents the following line.
Reminded by deraadt@ in Pest, Ujlipotvaros, Csanady utza.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/term.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c index 43d33868b43..4a40dcf7840 100644 --- a/usr.bin/mandoc/term.c +++ b/usr.bin/mandoc/term.c @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.65 2012/07/10 15:33:40 schwarze Exp $ */ +/* $Id: term.c,v 1.66 2012/07/16 21:28:12 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011, 2012 Ingo Schwarze <schwarze@openbsd.org> @@ -102,6 +102,7 @@ void 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,10 +141,12 @@ term_flushln(struct termp *p) * 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++; } @@ -188,6 +191,11 @@ term_flushln(struct termp *p) } else vbl = p->offset; + /* use pending tabs on the new line */ + + if (0 < ntab) + vbl += ntab * p->tabwidth; + /* Remove the p->overstep width. */ bp += (size_t)p->overstep; |