-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Columns are not rendered when the table width exceeds the currently set width.Defaulting #35
Comments
Hi, i think that the issue lies at TTY::Table::Orientation::Vertical::slice called by TTY::Table::rotate_vertical when the header is nil and it generates a 'head' to number the columns as rows: head = header ? header : (0..rows_size).map { |n| (n + 1).to_s } Without header it gets limited to the rows_size: t_rows = ['H', 'a', 'b', 'c'].map{|l| 9.times.map{|n| [l, n].join('_') } }
table = TTY::Table.new(t_rows)
puts table.render(width: 18)
The table size exceeds the currently set width.Defaulting to vertical orientation.
1 H_0
2 H_1
3 H_2
4 H_3
5 H_4
1 a_0
2 a_1
3 a_2
4 a_3
5 a_4
1 b_0
2 b_1
3 b_2
4 b_3
5 b_4
1 c_0
2 c_1
3 c_2
4 c_3
5 c_4
=> ##nil Providing a header it prints all columns: table = TTY::Table.new(t_rows.shift, t_rows)
puts table.render(width: 18)
The table size exceeds the currently set width.Defaulting to vertical orientation.
H_0 a_0
H_1 a_1
H_2 a_2
H_3 a_3
H_4 a_4
H_5 a_5
H_6 a_6
H_7 a_7
H_8 a_8
H_0 b_0
H_1 b_1
H_2 b_2
H_3 b_3
H_4 b_4
H_5 b_5
H_6 b_6
H_7 b_7
H_8 b_8
H_0 c_0
H_1 c_1
H_2 c_2
H_3 c_3
H_4 c_4
H_5 c_5
H_6 c_6
H_7 c_7
H_8 c_8
=> ##nil Generating the head at vertical.rb#L29 with the columns_count instead: head = header ? header : (1..table.columns_count).map(&:to_s) seems to fix the issue: puts table.render(width: 18)
The table size exceeds the currently set width.Defaulting to vertical orientation.
1 H_0
2 H_1
3 H_2
4 H_3
5 H_4
6 H_5
7 H_6
8 H_7
9 H_8
1 a_0
2 a_1
3 a_2
4 a_3
5 a_4
6 a_5
7 a_6
8 a_7
9 a_8
1 b_0
2 b_1
3 b_2
4 b_3
5 b_4
6 b_5
7 b_6
8 b_7
9 b_8
1 c_0
2 c_1
3 c_2
4 c_3
5 c_4
6 c_5
7 c_6
8 c_7
9 c_8
=> nil Please tell me if you would wish a pull request. Cheers, Paulo |
N trailing columns are hidden when the table size exceeds the currently set width. I would assume that they should be vertically rendered as it is already happening with the non hidden columns.
Steps to reproduce the problem
Case 1
Case 2
The width of 30 is artifical. You can also resize your terminal window to a size smaller than all rows combined.
Actual behaviour
Case 1
Case 2
I do not see the reason for this behaviour in the code yet. It does not make sense to render more or less columns depending on the amount of given rows and columns.
Expected behaviour
Case 1
Case 2
Describe your environment
Thanks
Thank you for your great tty gems. I truly love them all and they provide joy to my job. I do not expect a bugfix but merely want to provide a report of the bug.
The text was updated successfully, but these errors were encountered: