Skip to content

Wrap doesn't align attributes #508

Open
@allsey87

Description

@allsey87

I'm not sure if this is a bug or a feature request but currently if I have the following tag:

<tag attributea="valuea" attributeb="valueb" attributec="valuec"></tag>

It will wrap as follows if I add the option wrap: 50

<tag attributea="valuea" attributeb="valueb" 
attributec="valuec"></tag>

Alternatively, if I instead add the option indent-attributes: on I get

<tag attributea="valuea"
     attributeb="valueb"
     attributec="valuec"></tag>

What I want and what I think should be the default behavior for the wrap: 50 option, is this:

<tag attributea="valuea" attributeb="valueb"
     attributec="valuec"></tag>

I checked out, built and inspected the code with GDB to see if I could quickly implement this myself. I can see that the indenting is done in a loop by inserting either a tab or a space character after all call to GetSpaces which returns the value pprint->ident[0]. I think I just need to make the smallest of changes to either PPrintAttrValue or PPrintAttribute, but I really have no idea how to proceed or whether this should be done in a different part of the code entirely.

If this isn't a bug and the strange default alignment of attributes is desirable, perhaps indent-attributes could be changed to an enum option with: on, off, and afterwrap possibilities?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions