From 8241460f5a729b577b0d7da544fe8f8fcda18d14 Mon Sep 17 00:00:00 2001 From: Hugo Herbelin Date: Wed, 20 May 2015 14:47:24 +0200 Subject: Answering report #4241 (formatting of boxes not behaving regularly when printing width extend). --- lib/pp_control.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/pp_control.ml') diff --git a/lib/pp_control.ml b/lib/pp_control.ml index 0d224c0351..7fe4e0f52d 100644 --- a/lib/pp_control.ml +++ b/lib/pp_control.ml @@ -20,7 +20,7 @@ let dflt_gp = { margin = 78; max_indent = 50; max_depth = 50; - ellipsis = ".." } + ellipsis = "..." } (* A deeper pretty-printer to print proof scripts *) @@ -84,5 +84,8 @@ let set_margin v = let v = match v with None -> default_margin | Some v -> v in Format.pp_set_margin Format.str_formatter v; Format.pp_set_margin !std_ft v; - Format.pp_set_margin !deep_ft v - + Format.pp_set_margin !deep_ft v; + let m = 64 * v / 100 in (* Heuristic, based on usage *) + Format.pp_set_max_indent Format.str_formatter m; + Format.pp_set_max_indent !std_ft m; + Format.pp_set_max_indent !deep_ft m -- cgit v1.2.3 From 2eb7d2e20a2fc58ae91a5110f26e2f9a3699db46 Mon Sep 17 00:00:00 2001 From: Pierre Courtieu Date: Thu, 21 May 2015 18:14:56 +0200 Subject: Changing the heuristic fixing bug #4241. Fixed #4241 correlates Printing Width and max_indent, this patch changes the correlation to the following one: max_indent = max ((wdth*80)/100) (wdth-30) i.e. the right column defined by max_indent is 20% of the global width, but capped to 30 characters. --- lib/pp_control.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/pp_control.ml') diff --git a/lib/pp_control.ml b/lib/pp_control.ml index 7fe4e0f52d..969c1550ec 100644 --- a/lib/pp_control.ml +++ b/lib/pp_control.ml @@ -85,7 +85,9 @@ let set_margin v = Format.pp_set_margin Format.str_formatter v; Format.pp_set_margin !std_ft v; Format.pp_set_margin !deep_ft v; - let m = 64 * v / 100 in (* Heuristic, based on usage *) + (* Heuristic, based on usage: the column on the right of max_indent + column is 20% of width, capped to 30 characters *) + let m = max (64 * v / 100) (v-30) in Format.pp_set_max_indent Format.str_formatter m; Format.pp_set_max_indent !std_ft m; Format.pp_set_max_indent !deep_ft m -- cgit v1.2.3