Skip to content

Commit

Permalink
Correctly format term diffs with ~ in them
Browse files Browse the repository at this point in the history
  • Loading branch information
eproxus committed Sep 4, 2023
1 parent c00230c commit 7056093
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ The format is based on [Keep a Changelog], and this project adheres to

## [Unreleased]

### Fixed

- Fix crashing when formatting term diffs containing `~` control sequences

## [0.4.0] - 2022-11-29

### Added
Expand Down
4 changes: 1 addition & 3 deletions src/unite_compact.erl
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,9 @@ format_info(Failure, {cancelled, undefined}) ->

diff_prep_term(Term) ->
Pretty = format_term(Term, 0, 0),
Flat = iolist_to_binary(Pretty),
TermSplit = "([,\\[\\]\\{\\}]|\\s+=>\\s+|#\\{)",
re:split(Flat, TermSplit, [trim]).
re:split(string:replace(Pretty, "~", "~~"), TermSplit, [trim]).
format_term(Term, Indent, Outer) ->

io_lib_pretty:print(Term, Indent, columns() - Outer, -1).
format_diff([]) ->
Expand Down

0 comments on commit 7056093

Please sign in to comment.