tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: tech@mdocml.bsd.lv
Subject: Bugs and regressions in .Bk
Date: Sun, 6 Feb 2011 21:39:30 +0100	[thread overview]
Message-ID: <20110206203930.GH28747@iris.usta.de> (raw)
In-Reply-To: <201101251620.p0PGKPeH004751@krisdoz.my.domain>

Hi Kristaps,

> Log Message:
> -----------
> Arguments to `Bsx' and friends are separated by a non-breaking space.
> This removes a TODO raised by schwarze@.

While trying to merge this patch, i ran into a regression:
When called inside .Bk or in the SYNOPSIS, this patch ends
keep mode.

Trying to fix that (meanwhile, i have a working fix, so don't
waste your time searching for it), i ran into another .Bk bug:
For text generated in the pre-handler, setting up keep state
comes too late to take effect.

So, my plan is to

 1) Get the following patch in, fixing the latter bug - OK?
    The code is unchanged, it is just moved around.

 2) Once that's in, merge your patch to OpenBSD, together
    with my fix for the regression.

 3) Finally, merge back my regression fix to bsd.lv.

Yours,
  Ingo


Index: usr.bin/mandoc/mdoc_term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v
retrieving revision 1.127
diff -u -p -r1.127 mdoc_term.c
--- usr.bin/mandoc/mdoc_term.c	6 Feb 2011 17:33:20 -0000	1.127
+++ usr.bin/mandoc/mdoc_term.c	6 Feb 2011 20:32:04 -0000
@@ -308,22 +308,6 @@ print_mdoc_node(DECL_ARGS)
 
 	memset(&npair, 0, sizeof(struct termpair));
 	npair.ppair = pair;
-	
-	switch (n->type) {
-	case (MDOC_TEXT):
-		if (' ' == *n->string && MDOC_LINE & n->flags)
-			term_newln(p);
-		term_word(p, n->string);
-		break;
-	case (MDOC_TBL):
-		term_tbl(p, n->span);
-		break;
-	default:
-		if (termacts[n->tok].pre && ENDBODY_NOT == n->end)
-			chld = (*termacts[n->tok].pre)
-				(p, &npair, m, n);
-		break;
-	}
 
 	/*
 	 * Keeps only work until the end of a line.  If a keep was
@@ -354,6 +338,22 @@ print_mdoc_node(DECL_ARGS)
 	    ((n->prev   && MDOC_SYNPRETTY & n->prev->flags) ||
 	     (n->parent && MDOC_SYNPRETTY & n->parent->flags)))
 		p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
+
+	switch (n->type) {
+	case (MDOC_TEXT):
+		if (' ' == *n->string && MDOC_LINE & n->flags)
+			term_newln(p);
+		term_word(p, n->string);
+		break;
+	case (MDOC_TBL):
+		term_tbl(p, n->span);
+		break;
+	default:
+		if (termacts[n->tok].pre && ENDBODY_NOT == n->end)
+			chld = (*termacts[n->tok].pre)
+				(p, &npair, m, n);
+		break;
+	}
 
 	if (chld && n->child)
 		print_mdoc_nodelist(p, &npair, m, n->child);
Index: regress/usr.bin/mandoc/mdoc/Bk/break.in
===================================================================
RCS file: /cvs/src/regress/usr.bin/mandoc/mdoc/Bk/break.in,v
retrieving revision 1.1
diff -u -p -r1.1 break.in
--- regress/usr.bin/mandoc/mdoc/Bk/break.in	19 Dec 2010 12:10:33 -0000	1.1
+++ regress/usr.bin/mandoc/mdoc/Bk/break.in	6 Feb 2011 20:32:04 -0000
@@ -5,6 +5,24 @@
 .Nm Bk-break
 .Nd handling of word keeps
 .Sh DESCRIPTION
+Even though it is called a word keep,
+.Bk -words
+it will not keep words together in free-form text.
+.Ek
+However, even the noop macro
+.Bk -words
+.No is sufficient to let the keep take effect .
+.Ek
+Even text generated in pre-handlers must be kept together with
+the text following it:
+.Bk -words
+.Xr one 1 No and Xr two 2
+.Ek
+should be on the same line.
+.Pp
+Including the whole output line into the keep is not required,
+including just the macros to be kept together is sufficient:
+.Pp
 .Nm
 .Ar x x x x x x x x
 .Ar x x x x x x x x
Index: regress/usr.bin/mandoc/mdoc/Bk/break.out_ascii
===================================================================
RCS file: /cvs/src/regress/usr.bin/mandoc/mdoc/Bk/break.out_ascii,v
retrieving revision 1.1
diff -u -p -r1.1 break.out_ascii
--- regress/usr.bin/mandoc/mdoc/Bk/break.out_ascii	19 Dec 2010 12:10:33 -0000	1.1
+++ regress/usr.bin/mandoc/mdoc/Bk/break.out_ascii	6 Feb 2011 20:32:04 -0000
@@ -4,6 +4,15 @@ N\bNA\bAM\bME\bE
      B\bBk\bk-\b-b\bbr\bre\bea\bak\bk - handling of word keeps
 
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+     Even though it is called a word keep, it will not keep words together in
+     free-form text.  However, even the noop macro
+     is sufficient to let the keep take effect.  Even text generated in pre-
+     handlers must be kept together with the text following it:
+     one(1) and two(2) should be on the same line.
+
+     Including the whole output line into the keep is not required, including
+     just the macros to be kept together is sufficient:
+
      B\bBk\bk-\b-b\bbr\bre\bea\bak\bk _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx _\bx
      [o _\ba]
 
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

       reply	other threads:[~2011-02-06 20:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201101251620.p0PGKPeH004751@krisdoz.my.domain>
2011-02-06 20:39 ` Ingo Schwarze [this message]
2011-02-06 21:46   ` Kristaps Dzonsons
2011-02-06 23:07     ` Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110206203930.GH28747@iris.usta.de \
    --to=schwarze@usta.de \
    --cc=tech@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).