Skip to content

utop overwrites Format.std_formatter geometry #487

@sim642

Description

@sim642

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions