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

AnsiTextCell overwrites following cells when show_row_number is set #208

Closed
staticfloat opened this issue Jul 18, 2023 · 3 comments
Closed

Comments

@staticfloat
Copy link

Example:

julia> using PrettyTables

       table = Dict(
           :x => ["totally not an a"],
           :xx => [AnsiTextCell("a")],
       )
       pretty_table(stdout, table; show_row_number = true)
┌─────┬──────────────┬──────────────────┐
│ Row │           xx │                x │
│     │ AnsiTextCell │           String │
├─────┼──────────────┼──────────────────┤
│   1 │            a │ a │
└─────┴──────────────┴──────────────────┘

Note how the second cell should not say a, it should say totally not an a. Also note how this is somewhat Dict-key-ordering-sensitive; if the AnsiTextCell comes as the last column, everything looks fine:

julia> using PrettyTables

       table = Dict(
           :xx => ["totally not an a"],
           :x => AnsiTextCell[AnsiTextCell("a")],
       )
       pretty_table(stdout, table; show_row_number = true)
┌─────┬──────────────────┬──────────────┐
│ Row │               xx │            x │
│     │           String │ AnsiTextCell │
├─────┼──────────────────┼──────────────┤
│   1 │ totally not an a │            a │
└─────┴──────────────────┴──────────────┘
@ronisbr
Copy link
Owner

ronisbr commented Jul 21, 2023

Ops! I missed that notification. Thanks @staticfloat, let me see what's happening here.

@ronisbr
Copy link
Owner

ronisbr commented Jul 21, 2023

Done! I was a regression due to the last commit. The problem is that I have three types of indices:

  1. The index of the data in the original table.
  2. The index of the data in the processed table (with additional columns).
  3. The index of the data in the string table considering the cropping.

I always get confused with those things :)

Thank you very much for the report.

@staticfloat
Copy link
Author

Awesome! I really appreciate how quick you are to deal with these reports, thank you!

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