ronisbr / PrettyTables.jl

Print data in formatted tables.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AnsiTextCell overwrites following cells when `show_row_number` is set

staticfloat opened this issue · comments

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 │
└─────┴──────────────────┴──────────────┘

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

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.

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