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

[Feature Request] Allow table to be padded with a row of empty cells #94

Open
ashmaroli opened this issue Aug 2, 2017 · 3 comments
Open

Comments

@ashmaroli
Copy link

The feature I have in mind would improve readability when all_separators is false.

  • padding_top is available only if a title row exists.
  • padding_bottom is available either ways.

To illustrate:

Without table-padding (Current)

+------------+-------------+-----------+
| First Name | Middle Name | Last Name |
+------------+-------------+-----------+
| John       | Malkov      | Stuart    |
| Jane       | Roberta     | Phillips  |
| Chris      | Malcom      | Little    |
| Amy        | Jack        | Robinson  |
+------------+-------------+-----------+

With new table-padding: (Style 1)

+------------+-------------+-----------+
| First Name | Middle Name | Last Name |
+------------+-------------+-----------+
|            |             |           |
| John       | Malkov      | Stuart    |
| Jane       | Roberta     | Phillips  |
| Chris      | Malcom      | Little    |
| Amy        | Jack        | Robinson  |
+------------+-------------+-----------+
+------------+-------------+-----------+
| John       | Malkov      | Stuart    |
| Jane       | Roberta     | Phillips  |
| Chris      | Malcom      | Little    |
| Amy        | Jack        | Robinson  |
+------------+-------------+-----------+

With new table-padding: (Style 2)

+------------+-------------+-----------+
| First Name | Middle Name | Last Name |
+------------+-------------+-----------+
|            |             |           |
| John       | Malkov      | Stuart    |
| Jane       | Roberta     | Phillips  |
| Chris      | Malcom      | Little    |
| Amy        | Jack        | Robinson  |
|            |             |           |
+------------+-------------+-----------+
+------------+-------------+-----------+
| John       | Malkov      | Stuart    |
| Jane       | Roberta     | Phillips  |
| Chris      | Malcom      | Little    |
| Amy        | Jack        | Robinson  |
|            |             |           |
+------------+-------------+-----------+
@KraevRoot
Copy link

@ashmaroli strange feature, how it can help with readability?

@ashmaroli
Copy link
Author

as illustrated in the examples above..

@jescholl
Copy link
Contributor

jescholl commented Nov 4, 2017

This is already possible by adding blank rows.

> headings = ['First Name', 'Middle Name', 'Last Name']
> rows = []
> rows << [' ', nil, nil]
> rows << %w{John Malkov Stuart}
> rows << %w{Jane Roberta Phillips}
> rows << %w{Chris Malcom Little}
> rows << %w{Amy Jack Robinson}
> rows << [' ', nil, nil]
> puts Terminal::Table.new(headings: headings, rows: rows)
+------------+-------------+-----------+
| First Name | Middle Name | Last Name |
+------------+-------------+-----------+
|            |             |           |
| John       | Malkov      | Stuart    |
| Jane       | Roberta     | Phillips  |
| Chris      | Malcom      | Little    |
| Amy        | Jack        | Robinson  |
|            |             |           |
+------------+-------------+-----------+

This could be made a little more intuitive if [nil, nil, nil] worked to make a blank row, but otherwise I don't really see the need to add this as a feature.

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

3 participants