Skip to content

Commit

Permalink
Merge pull request #10565 from wiktorkuchta/string-trunc
Browse files Browse the repository at this point in the history
oprint: Truncate strings only after 8 bytes
  • Loading branch information
Octachron committed Aug 28, 2021
2 parents b5ffb01 + c644bdf commit 7a40c57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ Working version
(Nicolás Ojeda Bär, report by Gabriel Scherer, review by Daniel Bünzli,
Gabriel Scherer and David Allsopp)

- #10565: Toplevel value printing: truncate strings only after 8 bytes.
(Wiktor Kuchta, review by Xavier Leroy)

### Manual and documentation:

- #7812, #10475: reworded the description of the behaviors of
Expand Down
1 change: 1 addition & 0 deletions typing/oprint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ let print_out_value ppf tree =
| Oval_string (s, maxlen, kind) ->
begin try
let len = String.length s in
let maxlen = max maxlen 8 in (* always show a little prefix *)
let s = if len > maxlen then String.sub s 0 maxlen else s in
begin match kind with
| Ostr_bytes -> fprintf ppf "Bytes.of_string %S" s
Expand Down

0 comments on commit 7a40c57

Please sign in to comment.