tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* [PATCH] .Sm spacing
@ 2010-07-13 21:46 Ingo Schwarze
  2010-07-13 23:13 ` Kristaps Dzonsons
  0 siblings, 1 reply; 2+ messages in thread
From: Ingo Schwarze @ 2010-07-13 21:46 UTC (permalink / raw)
  To: tech

Hi,

here is a very small patch to fix .Sm spacing.

When saying ".Sm on", you expect spacing to start right away, not after
the following token.  Thus, we need to clear the TERMP_NOSPACE flag in
addition to clearing TERMP_NONOSPACE.  On the other hand, we still do
not want spacing at the beginning of a line (in the sense of "line" as
defined in termp_flushln), so leave TERMP_NOSPACE intact when in
column 0.

In OpenBSD, this fixes the following pages for me:

 - chmod(1):
   The display right below "Symbolic modes",
    - chmod <[who]op[perm]>,[[who]op[perm]],[...]file [...]
    + chmod <[who]op[perm]>,[[who]op[perm]],[...] file [...]

 - ksh(1):
   A couple of cases where text followed stuff like
   ${name[expr]}, ${name=value}, <var><op>=<expr>
   without a space.

 - tar(1):
   The first SYNOPSIS:
    - tar {crtux}[014578befHhjLmOoPpqsvwXZz][blocking-factor
    -     | archive | replstr] [-C directory] [-I file] [file ...]
    + tar {crtux}[014578befHhjLmOoPpqsvwXZz]
    +     [blocking-factor | archive | replstr] [-C directory] [-I file]
    +     [file ...]

 - ps(1):
   The SYNOPSIS:
    - ps [-aCcehjkLlmrSTuvwx][-M core] [-N system] [-O fmt] [-o fmt] [-p pid]
    + ps [-aCcehjkLlmrSTuvwx] [-M core] [-N system] [-O fmt] [-o fmt] [-p pid]
         [-t tty] [-U username] [-W swap]

And probably more...

OK?

Yours,
  Ingo


Index: mdoc_term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v
retrieving revision 1.95
diff -u -p -r1.95 mdoc_term.c
--- mdoc_term.c	13 Jul 2010 01:09:13 -0000	1.95
+++ mdoc_term.c	13 Jul 2010 21:27:43 -0000
@@ -2062,9 +2062,11 @@ termp_sm_pre(DECL_ARGS)
 {
 
 	assert(n->child && MDOC_TEXT == n->child->type);
-	if (0 == strcmp("on", n->child->string))
+	if (0 == strcmp("on", n->child->string)) {
+		if (p->col)
+			p->flags &= ~TERMP_NOSPACE;
 		p->flags &= ~TERMP_NONOSPACE;
-	else
+	} else
 		p->flags |= TERMP_NONOSPACE;
 
 	return(0);
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] .Sm spacing
  2010-07-13 21:46 [PATCH] .Sm spacing Ingo Schwarze
@ 2010-07-13 23:13 ` Kristaps Dzonsons
  0 siblings, 0 replies; 2+ messages in thread
From: Kristaps Dzonsons @ 2010-07-13 23:13 UTC (permalink / raw)
  To: tech

> here is a very small patch to fix .Sm spacing.
> 
> When saying ".Sm on", you expect spacing to start right away, not after
> the following token.  Thus, we need to clear the TERMP_NOSPACE flag in
> addition to clearing TERMP_NONOSPACE.  On the other hand, we still do
> not want spacing at the beginning of a line (in the sense of "line" as
> defined in termp_flushln), so leave TERMP_NOSPACE intact when in
> column 0.
> 
> In OpenBSD, this fixes the following pages for me:
> 
>  - chmod(1):
>    The display right below "Symbolic modes",
>     - chmod <[who]op[perm]>,[[who]op[perm]],[...]file [...]
>     + chmod <[who]op[perm]>,[[who]op[perm]],[...] file [...]
> 
>  - ksh(1):
>    A couple of cases where text followed stuff like
>    ${name[expr]}, ${name=value}, <var><op>=<expr>
>    without a space.
> 
>  - tar(1):
>    The first SYNOPSIS:
>     - tar {crtux}[014578befHhjLmOoPpqsvwXZz][blocking-factor
>     -     | archive | replstr] [-C directory] [-I file] [file ...]
>     + tar {crtux}[014578befHhjLmOoPpqsvwXZz]
>     +     [blocking-factor | archive | replstr] [-C directory] [-I file]
>     +     [file ...]
> 
>  - ps(1):
>    The SYNOPSIS:
>     - ps [-aCcehjkLlmrSTuvwx][-M core] [-N system] [-O fmt] [-o fmt] [-p pid]
>     + ps [-aCcehjkLlmrSTuvwx] [-M core] [-N system] [-O fmt] [-o fmt] [-p pid]
>          [-t tty] [-U username] [-W swap]

Patch looks fine by me.  But "ok kristaps" only on mdoc.7 addition :-)
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-13 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-13 21:46 [PATCH] .Sm spacing Ingo Schwarze
2010-07-13 23:13 ` Kristaps Dzonsons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).