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

Add header_align argument #102

Open
rlabbe opened this issue Mar 30, 2021 · 5 comments · Fixed by #183
Open

Add header_align argument #102

rlabbe opened this issue Mar 30, 2021 · 5 comments · Fixed by #183
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@rlabbe
Copy link

rlabbe commented Mar 30, 2021

The idea here is to be able to align the header separately from the values. For example, when I print floats I like the decimal points to align, and I get that with align='r'. But then the header names are all the way to the right, and you end up with

                   x
    12346.657

whereas I'd like:
            x
    12346.657

@hugovk hugovk added the enhancement New feature or request label Mar 30, 2021
@hugovk
Copy link
Member

hugovk commented Mar 30, 2021

I'd be open to looking at a PR for this.

@hugovk hugovk added the help wanted Extra attention is needed label Mar 19, 2022
@hugovk
Copy link
Member

hugovk commented Sep 2, 2022

Re-opening as #183 was reverted, a new PR is welcome, thanks!

@hugovk hugovk reopened this Sep 2, 2022
@myheroyuki
Copy link
Contributor

Hi, I'm willing to give this one another attempt. @hugovk, what do you think the correct behavior should be. I think that header_align should take precedence if both header_align and align are set. It seems strange to me to allow the user to use align for a individual header fields when header_align exists, but I can see from the issue mentioned in the pull request it's needed to ensure backwards capability.

I think the best solution is that align should work as always as long as no header_align is set. If the user ever does set header align, it will be used to set the alignment for header fields. This could be bit confusing though if header_align is set very early on, and the user later changes a specific header field's alignment at the end using align, as that align value would be ignored. I suppose that's fine as long as it's documented though.

@hugovk
Copy link
Member

hugovk commented Sep 6, 2022

Hi, thank you! Yes, that sounds about right :)

  • If only align is set, it's the "global" option that applies to both header and body.

  • If only header_align is set, use header_align for the header, no change to the body.

  • If both header_align and align are set, use header_align for the header, and align for the body.

Ping also @osfrickler and @SeanMooney: how does this sound?

@SeanMooney
Copy link

"""If only align is set, it's the "global" option that applies to both header and body."""

i think that would maintain the behaviour we are currently depending on in our test yes.

the rest also make logical sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants