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

Fix fill wrapping when text starts with whitespace #1666

Merged
merged 1 commit into from May 22, 2017

Conversation

karl
Copy link
Collaborator

@karl karl commented May 22, 2017

There is a bug in the fill implementation in #1120 when text starts with a whitespace.

Input:

leading_whitespace =
  <div> First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth</div>

Output on master:

leading_whitespace = (
  <div>
    {" "}
    First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
  </div>
);

The fill algorithm expects to be passed alternating content and whitespace parts, starting with content. Before this PR it was possible for it to start with a whitespace, throwing off the algorithm.

Output with this PR:

leading_whitespace = (
  <div>
    {" "}
    First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh
    Twelfth Thirteenth Fourteenth
  </div>
);

@vjeux vjeux merged commit 4083d92 into prettier:master May 22, 2017
@vjeux
Copy link
Contributor

vjeux commented May 22, 2017

Thanks :)

@karl karl deleted the jsx-fill-with-leading-whitespace branch June 26, 2017 19:43
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 20, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants