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

Width triggers the wrap after the overflow #114

Open
dga-nagra opened this issue Apr 30, 2024 · 0 comments
Open

Width triggers the wrap after the overflow #114

dga-nagra opened this issue Apr 30, 2024 · 0 comments

Comments

@dga-nagra
Copy link

dga-nagra commented Apr 30, 2024

Description

We can give a width so that a line will be wrapped automatically:

ruamel= yaml.YAML()
ruamel.width = 80

The issue is that this will trigger the line-wrap after it overflows. For example, suppose we define the width to 80 and have the following to dump:

mylist: [ onequitelongitem, secondquitelongitem, thirdmuchlongeritem, thelongestelementofthelistthatoverflows ]

Proposal

The library will dump it this way because just after thirdmuchlongeritem we only have about 70 characters, therefore we add the last element on the same line. The library should give an option to wrap the line before the overflow happens.

The previous example would result into this instead:

mylist: [ onequitelongitem, secondquitelongitem, thirdmuchlongeritem,
              thelongestelementofthelistthatoverflows ]
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

1 participant