Skip to content

Commit

Permalink
Reduce excessive linebreaks when printing large terms.
Browse files Browse the repository at this point in the history
This is accomplished by using a layout with an extremely large
page width, combined with a normal (64-character) ribbon width.
With this setup, the pretty-printer should almost never in practice
go into the bayond-the-margin mode where it prints only one token
per line.

Fixes #1618.
  • Loading branch information
Brian Huffman committed Apr 22, 2022
1 parent b6e9afc commit e16cc8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion saw-core/src/Verifier/SAW/Term/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ renderSawDoc :: PPOpts -> SawDoc -> String
renderSawDoc ppOpts doc =
Text.Lazy.unpack (renderLazy (style (layoutPretty layoutOpts doc)))
where
layoutOpts = LayoutOptions (AvailablePerLine 80 0.8)
-- ribbon width 64, with effectively unlimited right margin
layoutOpts = LayoutOptions (AvailablePerLine 8000 0.008)
style = if ppColor ppOpts then reAnnotateS colorStyle else unAnnotateS

-- | Pretty-print a term and render it to a string, using the given options
Expand Down

0 comments on commit e16cc8c

Please sign in to comment.