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

No indent for 1st line but padding for other lines #20

Open
Robert-M-Muench opened this issue May 9, 2022 · 2 comments
Open

No indent for 1st line but padding for other lines #20

Robert-M-Muench opened this issue May 9, 2022 · 2 comments

Comments

@Robert-M-Muench
Copy link

If I have a label and want to output some multi-line text, which is aligned, how to do this?

label: my text is here
       and should continue here

text.Warp(..., text.WarpIndent(""), text.WrapPadded(6)) doesn't work, because with an empty string, the padding is applied to the first line too.

@MichaelMure
Copy link
Owner

It's a bug indeed, indent is replaced by the padding as it's an empty string: https://github.com/MichaelMure/go-term-text/blob/master/wrap.go#L57-L59

There should be some marker string to signify "no indent", or use a pointer with nil.

@Robert-M-Muench
Copy link
Author

Deleting those lines should be enough. If I use "" that's meaning don't do any indenting.

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

No branches or pull requests

2 participants