summaryrefslogtreecommitdiffstats
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-07-02 19:55:10 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-07-02 19:55:10 +0000
commitfdc95e0f088e210664eb7459003c922102fc748e (patch)
tree2941a73b51965c3192f9e63b7579762c3e8c0ad5 /mdoc_term.c
parente98d951b402f5f61bf0fafc86ae5ad5a03f1c85e (diff)
downloadmandoc-fdc95e0f088e210664eb7459003c922102fc748e.tar.gz
When .Sm is called without an argument, groff toggles the spacing mode,
so let us do the same for compatibility. Using this feature is of course not recommended except in manual page obfuscation contests.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 98eafa4f..89cdbdd6 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -2056,14 +2056,16 @@ static int
termp_sm_pre(DECL_ARGS)
{
- assert(n->child && MDOC_TEXT == n->child->type);
- if (0 == strcmp("on", n->child->string)) {
- if (p->col)
- p->flags &= ~TERMP_NOSPACE;
+ if (NULL == n->child)
+ p->flags ^= TERMP_NONOSPACE;
+ else if (0 == strcmp("on", n->child->string))
p->flags &= ~TERMP_NONOSPACE;
- } else
+ else
p->flags |= TERMP_NONOSPACE;
+ if (p->col && ! (TERMP_NONOSPACE & p->flags))
+ p->flags &= ~TERMP_NOSPACE;
+
return(0);
}