tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Re: mdocml: Fix how `Bd -unfilled' and `Bd -literal' break lines.
       [not found] <201007270838.o6R8c4KT001163@krisdoz.my.domain>
@ 2010-07-31 17:57 ` Ingo Schwarze
  2010-08-04  0:40   ` Ingo Schwarze
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Schwarze @ 2010-07-31 17:57 UTC (permalink / raw)
  To: tech

Hi Kristaps,

kristaps@mdocml.bsd.lv wrote on Tue, Jul 27, 2010 at 04:38:04AM -0400:

> Log Message:
> -----------
> Fix how `Bd -unfilled' and `Bd -literal' break lines.  This unbreaks
> displays to work as old groff shows them; however, new groff still does
> some fancy shit.

What exactly is this supposed to fix?

> Modified Files:
> --------------
>     mdocml:
>         mdoc_term.c
>         mdoc_html.c

I don't care that much about the HTML part, so i'm snipping that,
but i disagree with the following chunk:

[...]
> Index: mdoc_term.c
> ===================================================================
> RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
> retrieving revision 1.178
> retrieving revision 1.179
> diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.178 -r1.179
> --- mdoc_term.c
> +++ mdoc_term.c
[...]
> @@ -1654,12 +1653,9 @@ termp_bd_pre(DECL_ARGS)
>  	p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
>  
>  	for (nn = n->child; nn; nn = nn->next) {
> -		p->flags |= TERMP_NOSPACE;
> +		if (nn->prev && nn->prev->line < nn->line)
> +			term_newln(p);
>  		print_mdoc_node(p, pair, m, nn);
> -		if (NULL == nn->prev ||
> -		    nn->prev->line < nn->line ||
> -		    NULL == nn->next)
> -			term_flushln(p);
>  	}
>  
>  	p->tabwidth = tabwidth;

For me, this breaks .Bd -literal vertical and horizontal spacing
in multiple ways, see

  mdoc/Bd/blank.in
  char/space/tab.in

in the OpenBSD regression suite.

To be precise, i see at least the following problems:

 * Removing the TERMP_NOSPACE adds an additional space character
   at the beginning of display lines which we don't want.
 * Changing term_flushln to term_newln has the effect of
   ignoring blank lines, but blank lines must be preserved
   in -literal mode.
 * Removing the NULL == nn->next clause kills trailing
   blank lines in -literal displays.  Even these must be
   preserved.

So, for now, i'm not merging any of the changes of this chunk
to OpenBSD.

Yours,
  Ingo
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

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

* Re: mdocml: Fix how `Bd -unfilled' and `Bd -literal' break lines.
  2010-07-31 17:57 ` mdocml: Fix how `Bd -unfilled' and `Bd -literal' break lines Ingo Schwarze
@ 2010-08-04  0:40   ` Ingo Schwarze
  2010-08-06 15:25     ` Kristaps Dzonsons
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Schwarze @ 2010-08-04  0:40 UTC (permalink / raw)
  To: tech

Oh well, i'm finally catching up...
Replying to myself:

Ingo Schwarze wrote on Sat, Jul 31, 2010 at 07:57:17PM +0200:
> kristaps@mdocml.bsd.lv wrote on Tue, Jul 27, 2010 at 04:38:04AM -0400:

>> Log Message:
>> -----------
>> Fix how `Bd -unfilled' and `Bd -literal' break lines.  This unbreaks
>> displays to work as old groff shows them; however, new groff still does
>> some fancy shit.

> What exactly is this supposed to fix?

I see now, i missed one of kristaps@' messages.
It fixes awk(1) and boot_config(8).
But it causes regressions with respect to blank lines.
 
>> Modified Files:
>> --------------
>>     mdocml:
>>         mdoc_term.c
>>         mdoc_html.c
> 
> I don't care that much about the HTML part, so i'm snipping that,
> but i disagree with the following chunk:
> 
> [...]
>> Index: mdoc_term.c
>> ===================================================================
>> RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
>> retrieving revision 1.178
>> retrieving revision 1.179
>> diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.178 -r1.179
>> --- mdoc_term.c
>> +++ mdoc_term.c
> [...]
>> @@ -1654,12 +1653,9 @@ termp_bd_pre(DECL_ARGS)
>>  	p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
>>  
>>  	for (nn = n->child; nn; nn = nn->next) {
>> -		p->flags |= TERMP_NOSPACE;
>> +		if (nn->prev && nn->prev->line < nn->line)
>> +			term_newln(p);
>>  		print_mdoc_node(p, pair, m, nn);
>> -		if (NULL == nn->prev ||
>> -		    nn->prev->line < nn->line ||
>> -		    NULL == nn->next)
>> -			term_flushln(p);
>>  	}
>>  
>>  	p->tabwidth = tabwidth;

> For me, this breaks .Bd -literal vertical and horizontal spacing
> in multiple ways, see
> 
>   mdoc/Bd/blank.in
>   char/space/tab.in
> 
> in the OpenBSD regression suite.
> 
> To be precise, i see at least the following problems:
> 
>  * Removing the TERMP_NOSPACE adds an additional space character
>    at the beginning of display lines which we don't want.
>  * Changing term_flushln to term_newln has the effect of
>    ignoring blank lines, but blank lines must be preserved
>    in -literal mode.
>  * Removing the NULL == nn->next clause kills trailing
>    blank lines in -literal displays.  Even these must be
>    preserved.
> 
> So, for now, i'm not merging any of the changes of this chunk
> to OpenBSD.

Here is an alternative patch which fixes the issues, too,
but does not cause regressions.  Apply to OpenBSD, or revert
the above before applying to bsd.lv:


Index: mdoc_term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v
retrieving revision 1.99
diff -u -p -r1.99 mdoc_term.c
--- mdoc_term.c	31 Jul 2010 21:43:07 -0000	1.99
+++ mdoc_term.c	4 Aug 2010 00:19:28 -0000
@@ -1649,12 +1649,11 @@ termp_bd_pre(DECL_ARGS)
 	p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
 
 	for (nn = n->child; nn; nn = nn->next) {
-		p->flags |= TERMP_NOSPACE;
 		print_mdoc_node(p, pair, m, nn);
-		if (NULL == nn->prev ||
-		    nn->prev->line < nn->line ||
-		    NULL == nn->next)
-			term_flushln(p);
+		if (nn->next && nn->next->line == nn->line)
+			continue;
+		term_flushln(p);
+		p->flags |= TERMP_NOSPACE;
 	}
 
 	p->tabwidth = tabwidth;
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

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

* Re: mdocml: Fix how `Bd -unfilled' and `Bd -literal' break lines.
  2010-08-04  0:40   ` Ingo Schwarze
@ 2010-08-06 15:25     ` Kristaps Dzonsons
  0 siblings, 0 replies; 3+ messages in thread
From: Kristaps Dzonsons @ 2010-08-06 15:25 UTC (permalink / raw)
  To: tech

[-- Attachment #1: Type: text/plain, Size: 3618 bytes --]

Ingo Schwarze wrote:
> Oh well, i'm finally catching up...
> Replying to myself:
> 
> Ingo Schwarze wrote on Sat, Jul 31, 2010 at 07:57:17PM +0200:
>> kristaps@mdocml.bsd.lv wrote on Tue, Jul 27, 2010 at 04:38:04AM -0400:
> 
>>> Log Message:
>>> -----------
>>> Fix how `Bd -unfilled' and `Bd -literal' break lines.  This unbreaks
>>> displays to work as old groff shows them; however, new groff still does
>>> some fancy shit.
> 
>> What exactly is this supposed to fix?
> 
> I see now, i missed one of kristaps@' messages.
> It fixes awk(1) and boot_config(8).
> But it causes regressions with respect to blank lines.
>  
>>> Modified Files:
>>> --------------
>>>     mdocml:
>>>         mdoc_term.c
>>>         mdoc_html.c
>> I don't care that much about the HTML part, so i'm snipping that,
>> but i disagree with the following chunk:
>>
>> [...]
>>> Index: mdoc_term.c
>>> ===================================================================
>>> RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
>>> retrieving revision 1.178
>>> retrieving revision 1.179
>>> diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.178 -r1.179
>>> --- mdoc_term.c
>>> +++ mdoc_term.c
>> [...]
>>> @@ -1654,12 +1653,9 @@ termp_bd_pre(DECL_ARGS)
>>>  	p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
>>>  
>>>  	for (nn = n->child; nn; nn = nn->next) {
>>> -		p->flags |= TERMP_NOSPACE;
>>> +		if (nn->prev && nn->prev->line < nn->line)
>>> +			term_newln(p);
>>>  		print_mdoc_node(p, pair, m, nn);
>>> -		if (NULL == nn->prev ||
>>> -		    nn->prev->line < nn->line ||
>>> -		    NULL == nn->next)
>>> -			term_flushln(p);
>>>  	}
>>>  
>>>  	p->tabwidth = tabwidth;
> 
>> For me, this breaks .Bd -literal vertical and horizontal spacing
>> in multiple ways, see
>>
>>   mdoc/Bd/blank.in
>>   char/space/tab.in
>>
>> in the OpenBSD regression suite.
>>
>> To be precise, i see at least the following problems:
>>
>>  * Removing the TERMP_NOSPACE adds an additional space character
>>    at the beginning of display lines which we don't want.
>>  * Changing term_flushln to term_newln has the effect of
>>    ignoring blank lines, but blank lines must be preserved
>>    in -literal mode.
>>  * Removing the NULL == nn->next clause kills trailing
>>    blank lines in -literal displays.  Even these must be
>>    preserved.
>>
>> So, for now, i'm not merging any of the changes of this chunk
>> to OpenBSD.
> 
> Here is an alternative patch which fixes the issues, too,
> but does not cause regressions.  Apply to OpenBSD, or revert
> the above before applying to bsd.lv:
> 
> 
> Index: mdoc_term.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v
> retrieving revision 1.99
> diff -u -p -r1.99 mdoc_term.c
> --- mdoc_term.c	31 Jul 2010 21:43:07 -0000	1.99
> +++ mdoc_term.c	4 Aug 2010 00:19:28 -0000
> @@ -1649,12 +1649,11 @@ termp_bd_pre(DECL_ARGS)
>  	p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
>  
>  	for (nn = n->child; nn; nn = nn->next) {
> -		p->flags |= TERMP_NOSPACE;
>  		print_mdoc_node(p, pair, m, nn);
> -		if (NULL == nn->prev ||
> -		    nn->prev->line < nn->line ||
> -		    NULL == nn->next)
> -			term_flushln(p);
> +		if (nn->next && nn->next->line == nn->line)
> +			continue;
> +		term_flushln(p);
> +		p->flags |= TERMP_NOSPACE;
>  	}
>  
>  	p->tabwidth = tabwidth;

Ingo et al.,

First note that I'm back by a machine, so can answer questions and so on.

This patch seems to work by my small tests, so ok kristaps.  I've 
enclosed a patch for mdoc_html.c, which you can throw in to the commit 
for completion's sake.

Thanks,

Kristaps

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 667 bytes --]

Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.100
diff -u -r1.100 mdoc_html.c
--- mdoc_html.c	27 Jul 2010 08:38:04 -0000	1.100
+++ mdoc_html.c	6 Aug 2010 15:19:38 -0000
@@ -1457,11 +1457,11 @@
 	print_otag(h, TAG_DIV, 2, tag);
 
 	for (nn = n->child; nn; nn = nn->next) {
-		if (nn->prev && nn->prev->line < nn->line) {
-			print_text(h, "\n");
-			h->flags |= HTML_NOSPACE;
-		}
 		print_mdoc_node(m, nn, h);
+		if (nn->next && nn->next->line == nn->line)
+			continue;
+		print_text(h, "\n");
+		h->flags |= HTML_NOSPACE;
 	}
 
 	return(0);

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

end of thread, other threads:[~2010-08-06 15:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201007270838.o6R8c4KT001163@krisdoz.my.domain>
2010-07-31 17:57 ` mdocml: Fix how `Bd -unfilled' and `Bd -literal' break lines Ingo Schwarze
2010-08-04  0:40   ` Ingo Schwarze
2010-08-06 15:25     ` 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).