diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-05-07 17:31:45 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-05-07 17:31:45 +0000 |
commit | df7add94ac0e6037b421b622febfdbe3236dad5c (patch) | |
tree | d3549eb68d21b93b68a624099f590ddb686ecfd9 /term.c | |
parent | 412e48b8cba6db0a6b8eae7f848cfa460e0a315d (diff) | |
download | mandoc-df7add94ac0e6037b421b622febfdbe3236dad5c.tar.gz |
Basic implementation of the roff(7) .ta (define tab stops) request.
This is the first feature made possible by the parser reorganization.
Improves the formatting of the SYNOPSIS in many Xenocara GL manuals.
Also important for ports, as reported by many, including naddy@.
Diffstat (limited to 'term.c')
-rw-r--r-- | term.c | 25 |
1 files changed, 14 insertions, 11 deletions
@@ -141,8 +141,8 @@ term_flushln(struct termp *p) * 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; + while (i < p->col && p->buf[i] == '\t') { + vend = term_tab_next(vis); vbl += vend - vis; vis = vend; ntab++; @@ -192,17 +192,20 @@ term_flushln(struct termp *p) vend -= vis; (*p->endline)(p); p->viscol = 0; - if (TERMP_BRIND & p->flags) { - vbl = p->rmargin; - vend += p->rmargin; - vend -= p->offset; - } else - vbl = p->offset; - /* use pending tabs on the new line */ + /* Use pending tabs on the new line. */ + + vbl = 0; + while (ntab--) + vbl = term_tab_next(vbl); - if (0 < ntab) - vbl += ntab * p->tabwidth; + /* Re-establish indentation. */ + + if (p->flags & TERMP_BRIND) { + vbl += p->rmargin; + vend += p->rmargin - p->offset; + } else + vbl += p->offset; /* * Remove the p->overstep width. |