tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: "tech@mdocml.bsd.lv" <tech@mdocml.bsd.lv>
Subject: Re: PATCH: break the line at an existing hyphen
Date: Tue, 25 May 2010 14:49:34 +0200	[thread overview]
Message-ID: <4BFBC75E.2000603@bsd.lv> (raw)
In-Reply-To: <20100524233201.GI21391@iris.usta.de>

> here is the final patch to get bsd.lv in sync with OpenBSD.
> 
> I know Kristaps backed something like this out once already,
> i guess it got in the way back then, before the term_flushln() cleanup.
> 
> But now, after the cleanup, this has become really easy,
> it is just three simple steps:
> 
>  1. While scanning forward for the first time, remember
>     the last hyphen fitting on the line.
>  2. When deciding whether to break the line at once,
>     don't do it when there is a useable hyphen.
>  3. Finally, while scanning forward for the second time,
>     i.e. in the output loop, break at the hyphen, if required.
> 
> Of course, it is not very difficult to make this a bit fancier
> and avoid some breaks that make little sense - but this is what
> OpenBSD has now, and it helps us to get in sync.
> 
> I would rather put this in than back it out, if only because
> it makes automatic comparisons a lot easier...
> 
> This final patch is also here:
>   /usr/vhosts/mdocml.bsd.lv/patch/schwarze/09.break-at-hyphen.patch

I've checked in a modified version of this that only breaks at free-form
line hyphens along with a regression test.  It touches term.c (your
exact patch, Ingo, except with ASCII_HYPH instead of the hyphen), html.c
(to print a hyphen (NOT a soft-break, see note)), mdoc.c (sitting in
Ingo's white-space loop), and mandoc.c (for the actual function of
choosing).

The same happens in -man, but I'll wait til Ingo applies his white-space
code to -man for this to be implemented.

Kristaps
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

  parent reply	other threads:[~2010-05-25 12:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24 23:32 Ingo Schwarze
2010-05-24 23:59 ` Kristaps Dzonsons
2010-05-25 12:49 ` Kristaps Dzonsons [this message]
2010-05-26  3:04   ` Ingo Schwarze
2010-05-26 11:37     ` Kristaps Dzonsons

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=4BFBC75E.2000603@bsd.lv \
    --to=kristaps@bsd.lv \
    --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).