tty-table
tty-table copied to clipboard
Top border is not indented correctly when table has no headers
Describe the problem
When rendering a table with an indent, if the table has no headers then the top border is not indented.
Steps to reproduce the problem
require 'tty-table'
ok = TTY::Table.new(header: ["H1","H2","H3"])
ok << ["a1","a2","a3"]
ok << ["b1","b2","b3"]
puts ok.render(:ascii, indent: 12)
broken = TTY::Table.new
broken << ["a1","a2","a3"]
broken << ["b1","b2","b3"]
puts broken.render(:ascii, indent: 12)
Actual behaviour
+--+--+--+
|H1|H2|H3|
+--+--+--+
|a1|a2|a3|
|b1|b2|b3|
+--+--+--+
+--+--+--+
|a1|a2|a3|
|b1|b2|b3|
+--+--+--+
Expected behaviour
+--+--+--+
|H1|H2|H3|
+--+--+--+
|a1|a2|a3|
|b1|b2|b3|
+--+--+--+
+--+--+--+
|a1|a2|a3|
|b1|b2|b3|
+--+--+--+
Describe your environment
- OS version: Darwin Kernel Version 23.2.0
- Ruby version: v3.2.1
- TTY::Table version: 0.12.0
I have raised PR #44 to fix this.