Skip to content

Width triggers the wrap after the overflow #114

@dga-nagra

Description

@dga-nagra

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 ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions