diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2023-11-13 19:13:01 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2023-11-13 19:13:01 +0000 |
commit | 6fbad40167aab34af92a8ee0415b1074df6bb25a (patch) | |
tree | 4ec4850b0f78c632cbafeb732f4cb3e7cc0064d6 | |
parent | db997d9447d9d1725adb781c7e400a42a303791e (diff) | |
download | mandoc-6fbad40167aab34af92a8ee0415b1074df6bb25a.tar.gz |
Reduce the man(7) default global indentation from 7n, which was an oddity
in groff-1.01 to groff-1.22.4, to 5n for compatibility with Version 7 AT&T
UNIX, 4.3BSD-Reno, groff-1.23.0, and all versions of mdoc(7).
OK jmc@ millert@
-rw-r--r-- | man_macro.c | 2 | ||||
-rw-r--r-- | man_term.c | 15 | ||||
-rw-r--r-- | mandoc.1 | 8 | ||||
-rw-r--r-- | mdoc_term.c | 5 | ||||
-rw-r--r-- | term_ascii.c | 5 |
5 files changed, 10 insertions, 25 deletions
diff --git a/man_macro.c b/man_macro.c index c2ea7d49..3fd10818 100644 --- a/man_macro.c +++ b/man_macro.c @@ -317,7 +317,7 @@ blk_exp(MACRO_PROT_ARGS) if (tok == MAN_RS) { if (roff_getreg(man->roff, "an-margin") == 0) roff_setreg(man->roff, "an-margin", - 7 * 24, '='); + 5 * 24, '='); if ((head->aux = strtod(p, NULL) * 24.0) > 0) roff_setreg(man->roff, "an-margin", head->aux, '+'); @@ -153,19 +153,15 @@ terminal_man(void *arg, const struct roff_meta *man) struct mtermp mt; struct termp *p; struct roff_node *n, *nc, *nn; - size_t save_defindent; p = (struct termp *)arg; - save_defindent = p->defindent; - if (p->synopsisonly == 0 && p->defindent == 0) - p->defindent = 7; p->tcol->rmargin = p->maxrmargin = p->defrmargin; term_tab_set(p, NULL); term_tab_set(p, "T"); term_tab_set(p, ".5i"); memset(&mt, 0, sizeof(mt)); - mt.lmargin[mt.lmargincur] = term_len(p, p->defindent); + mt.lmargin[mt.lmargincur] = term_len(p, 7); mt.offset = term_len(p, p->defindent); mt.pardist = 1; @@ -195,7 +191,6 @@ terminal_man(void *arg, const struct roff_meta *man) print_man_nodelist(p, &mt, n, man); term_end(p); } - p->defindent = save_defindent; } /* @@ -504,7 +499,7 @@ pre_PP(DECL_ARGS) { switch (n->type) { case ROFFT_BLOCK: - mt->lmargin[mt->lmargincur] = term_len(p, p->defindent); + mt->lmargin[mt->lmargincur] = term_len(p, 7); print_bvspace(p, n, mt->pardist); break; case ROFFT_HEAD: @@ -680,7 +675,7 @@ pre_SS(DECL_ARGS) switch (n->type) { case ROFFT_BLOCK: - mt->lmargin[mt->lmargincur] = term_len(p, p->defindent); + mt->lmargin[mt->lmargincur] = term_len(p, 7); mt->offset = term_len(p, p->defindent); /* @@ -721,7 +716,7 @@ pre_SH(DECL_ARGS) switch (n->type) { case ROFFT_BLOCK: - mt->lmargin[mt->lmargincur] = term_len(p, p->defindent); + mt->lmargin[mt->lmargincur] = term_len(p, 7); mt->offset = term_len(p, p->defindent); /* @@ -805,7 +800,7 @@ pre_RS(DECL_ARGS) if (++mt->lmarginsz < MAXMARGINS) mt->lmargincur = mt->lmarginsz; - mt->lmargin[mt->lmargincur] = term_len(p, p->defindent); + mt->lmargin[mt->lmargincur] = term_len(p, 7); return 1; } @@ -287,10 +287,7 @@ arguments are accepted: .It Cm indent Ns = Ns Ar indent The left margin for normal text is set to .Ar indent -blank characters instead of the default of five for -.Xr mdoc 7 -and seven for -.Xr man 7 . +blank characters instead of the default of five. Increasing this is not recommended; it may result in degraded formatting, for example overfull lines or ugly line breaks. When output is to a pager on a terminal that is less than 66 columns @@ -302,8 +299,7 @@ input files in .Xr mdoc 7 output style. This prints the operating system name rather than the page title -on the right side of the footer line, and it implies -.Fl O Cm indent Ns =5 . +on the right side of the footer line. One useful application is for checking that .Fl T Cm man output formats in the same way as the diff --git a/mdoc_term.c b/mdoc_term.c index db62ba31..73449e11 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -250,7 +250,6 @@ terminal_mdoc(void *arg, const struct roff_meta *mdoc) { struct roff_node *n, *nn; struct termp *p; - size_t save_defindent; p = (struct termp *)arg; p->tcol->rmargin = p->maxrmargin = p->defrmargin; @@ -275,9 +274,6 @@ terminal_mdoc(void *arg, const struct roff_meta *mdoc) print_mdoc_nodelist(p, NULL, mdoc, n); term_newln(p); } else { - save_defindent = p->defindent; - if (p->defindent == 0) - p->defindent = 5; term_begin(p, print_mdoc_head, print_mdoc_foot, mdoc); while (n != NULL && (n->type == ROFFT_COMMENT || @@ -289,7 +285,6 @@ terminal_mdoc(void *arg, const struct roff_meta *mdoc) print_mdoc_nodelist(p, NULL, mdoc, n); } term_end(p); - p->defindent = save_defindent; } } diff --git a/term_ascii.c b/term_ascii.c index 5c105f20..c2a2bb0d 100644 --- a/term_ascii.c +++ b/term_ascii.c @@ -72,6 +72,7 @@ ascii_init(enum termenc enc, const struct manoutput *outopts) p->maxtcol = 1; p->line = 1; + p->defindent = 5; p->defrmargin = p->lastrmargin = 78; p->fontq = mandoc_reallocarray(NULL, (p->fontsz = 8), sizeof(*p->fontq)); @@ -122,10 +123,8 @@ ascii_init(enum termenc enc, const struct manoutput *outopts) } #endif - if (outopts->mdoc) { + if (outopts->mdoc) p->mdocstyle = 1; - p->defindent = 5; - } if (outopts->indent) p->defindent = outopts->indent; if (outopts->width) |