caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Olivier Andrieu <oandrieu@nerim.net>
To: Alain Frisch <alain@frisch.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Understanding Format
Date: Tue, 24 Jul 2012 15:16:32 +0200	[thread overview]
Message-ID: <CAD5gH1G0GheUyPN-ELwEabqLvnt=6_CbLDj3txjOYQ_=QjHtPA@mail.gmail.com> (raw)
In-Reply-To: <500D13EA.8010002@frisch.fr>

Salut,

On Mon, Jul 23, 2012 at 11:05 AM, Alain Frisch <alain@frisch.fr> wrote:
> Hi all,
>
> I'm trying to understand the semantics of Format boxes, and I need some
> help!  Consider the following:
>
> let () =
>   set_margin 500;
>   open_vbox 0;
>   for _i = 1 to 300 do
>     open_hbox ();
>     print_string "x";
>     close_box ()
>   done;
>   close_box ()
>
>
> Format inserts line breaks, even though the page width (margin) should be
> large enough to contain 300 characters (and there is no break hint anyway).
> Why does it do it?   Changing the value passed to set_margin does not seem
> to make a difference (except for small values < 70).

You have to increase the 'max_indent' parameter for the formatter too :
  http://caml.inria.fr/pub/docs/manual-ocaml/libref/Format.html#VALset_max_indent

When you open your hbox, you get an implicit break if the current
cursor position is past this max_ident.
Calling set_margin does not change max_indent which keeps its default
value (68).

cf. this comment in format.ml :
(* To indent no more than pp_max_indent, if one tries to open a block
   beyond pp_max_indent, then the block is rejected on the left
   by simulating a break.
*)

HTH
-- 
  Olivier

      reply	other threads:[~2012-07-24 13:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23  9:05 Alain Frisch
2012-07-24 13:16 ` Olivier Andrieu [this message]

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='CAD5gH1G0GheUyPN-ELwEabqLvnt=6_CbLDj3txjOYQ_=QjHtPA@mail.gmail.com' \
    --to=oandrieu@nerim.net \
    --cc=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    /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).