I was screwing around with ocaml/ocaml#11517 and became really confused when even small Format margins wouldn't work. Apparently utop is overwriting Format.std_formatter geometry, so the same commands in utop and OCaml's own toplevel give different results.
Is this intentional somehow?
I would understand utop setting the margin based on terminal size initially, but overwriting it after/before every command gives the impression that Stdlib doesn't work.
utop
──────────┬──────────────────────────────────────────────────────────────┬───────────
│ Welcome to utop version 2.14.0 (using OCaml version 4.14.2)! │
└──────────────────────────────────────────────────────────────┘
Type #utop_help for help about using utop.
─( 11:23:44 )─< command 0 >───────────────────────────────────────────{ counter: 0 }─
utop # Format.get_margin ();;
- : int = 80
─( 11:23:44 )─< command 1 >───────────────────────────────────────────{ counter: 0 }─
utop # Format.set_margin 1000000;;
- : unit = ()
─( 11:23:48 )─< command 2 >───────────────────────────────────────────{ counter: 0 }─
utop # Format.get_margin ();;
- : int = 80
ocaml
OCaml version 4.14.2
Enter #help;; for help.
# Format.get_margin ();;
- : int = 78
# Format.set_margin 1000000;;
- : unit = ()
# Format.get_margin ();;
- : int = 1000000
I was screwing around with ocaml/ocaml#11517 and became really confused when even small
Formatmargins wouldn't work. Apparently utop is overwritingFormat.std_formattergeometry, so the same commands in utop and OCaml's own toplevel give different results.Is this intentional somehow?
I would understand utop setting the margin based on terminal size initially, but overwriting it after/before every command gives the impression that
Stdlibdoesn't work.utop
──────────┬──────────────────────────────────────────────────────────────┬─────────── │ Welcome to utop version 2.14.0 (using OCaml version 4.14.2)! │ └──────────────────────────────────────────────────────────────┘ Type #utop_help for help about using utop. ─( 11:23:44 )─< command 0 >───────────────────────────────────────────{ counter: 0 }─ utop # Format.get_margin ();; - : int = 80 ─( 11:23:44 )─< command 1 >───────────────────────────────────────────{ counter: 0 }─ utop # Format.set_margin 1000000;; - : unit = () ─( 11:23:48 )─< command 2 >───────────────────────────────────────────{ counter: 0 }─ utop # Format.get_margin ();; - : int = 80ocaml