Skip to content

Commit

Permalink
boxify: Don't print unit-like values (unit, empty list...)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukstafi committed Jan 18, 2024
1 parent b41c4f0 commit 034ce35
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
27 changes: 14 additions & 13 deletions minidebug_runtime.ml
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,20 @@ module PrintBox (Log_to : Debug_ch) = struct
let hls, bs = List.split @@ List.map loop l in
(List.exists (fun x -> x) hls, B.vlist bs)
in
let str =
if sexp_size sexp < min !boxify_sexp_from_size !max_inline_sexp_size then
Sexplib0.Sexp.to_string_hum sexp
else ""
in
if String.length str > 0 && String.length str < !max_inline_sexp_length then
highlight_box @@ B.text_with_style B.Style.preformatted (descr ^ " = " ^ str)
else
match sexp with
| Atom s | List [ Atom s ] ->
highlight_box @@ B.text_with_style B.Style.preformatted (descr ^ " = " ^ s)
| List [] -> highlight_box @@ B.line descr
| List l -> loop ~as_tree:true @@ List (Atom (descr ^ " =") :: l)
match sexp with
| Atom s | List [ Atom s ] ->
highlight_box @@ B.text_with_style B.Style.preformatted (descr ^ " = " ^ s)
| List [] -> highlight_box @@ B.line descr
| List l ->
let str =
if sexp_size sexp < min !boxify_sexp_from_size !max_inline_sexp_size then
Sexplib0.Sexp.to_string_hum sexp
else ""
in
if String.length str > 0 && String.length str < !max_inline_sexp_length then
(* TODO: Desing choice: consider not using monospace, at least for descr. *)
highlight_box @@ B.text_with_style B.Style.preformatted (descr ^ " = " ^ str)
else loop ~as_tree:true @@ List (Atom (descr ^ " =") :: l)

let num_children () = match !stack with [] -> 0 | { body; _ } :: _ -> List.length body

Expand Down
Loading

0 comments on commit 034ce35

Please sign in to comment.