Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pp: fix the width and indentation of second and later line contents #5978

Merged

Conversation

makenowjust
Copy link
Contributor

For example,

class X
  def pretty_print(pp : PrettyPrint)
    100.times do
      pp.group do
        pp.text "x"
        pp.breakable
      end
    end
  end
end

pp X.new

Above code prints this:

X.new # => x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
           x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
           x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
           x x x x x x x

This second and third lines are shorter than first line, it seems odd.

Expected result:

X.new # => x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
           x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
           x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x

This PR fixes pp and PrettyPrint to output correctly.

@RX14 RX14 added this to the Next milestone Apr 21, 2018
@RX14 RX14 merged commit 32f46c1 into crystal-lang:master Apr 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants