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: line wrapping for examples without desc #749

Merged
merged 1 commit into from Jan 16, 2017
Merged

Conversation

maxrimue
Copy link
Member

@maxrimue maxrimue commented Jan 4, 2017

This PR fixes #697. Now, if an example is defined without a description, the usage example will take up the entire line instead of just 50% of it.

Copy link
Member

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good to me 👍 thanks for taking this on.

ui.div(
{
text: example[0],
padding: [0, 2, 0, 2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rather than having no wrap here, you should use theWrap; this way the example will still wrap onto multiple lines at the width boundary, but will take up a full line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcoe So you mean I should add a width property like in line 276? 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxrimue I think you want width: maxWidth(theWrap) + 4.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcoe I've looked at this again but it seems that even without the width property it takes up the full line:
bildschirmfoto 2017-01-10 um 14 48 51

Isn't that what you meant with but it will take up a full line?
Using the width property like you suggested makes it wrap after each character:
bildschirmfoto 2017-01-10 um 14 44 41

Anyway, what I besides would suggest is perhaps adding a newline after each example to make it more distinguishable:
bildschirmfoto 2017-01-10 um 14 50 53

This can be achieved very easily with a bottom padding of 1.

Copy link
Member

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxrimue my bad, we only need to specify width in a multi-column layout I believe.

@bcoe bcoe merged commit 7931652 into master Jan 16, 2017
@bcoe bcoe deleted the fix/examples-wrapping branch January 16, 2017 23:48
@bcoe
Copy link
Member

bcoe commented Feb 27, 2017

@maxrimue was hacking all weekend landing various tickets for 7.x; this work should be on master now 👍

would love your help testing, like everything!

npm cache clear; npm i yargs@next

FYI: meet @pahdo, and @stevezhu, they were helping land a ton of features this weekend at HackIllinois! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

if no description is provided, allow first argument to example to take up entire line
2 participants