tty-table
tty-table copied to clipboard
Fix indent bug for tables without headers (issue piotrmurach/tty-table/issues/45)
Describe the change
There is a bug rendering tables without headers with an indent. The top border is not indented.
Why are we doing this?
Bug fix.
Benefits
Bug fix.
Drawbacks
None.
Here is come code that demonstrates the problem:
require 'tty-table'
ok = TTY::Table.new(header: ["Home","H","A","Away"])
ok << ["team1",1,2,"team2"]
ok << ["team3",0,1,"team4"]
puts ok.render(:unicode, indent: 12)
broken = TTY::Table.new
broken << ["team1",1,2,"team2"]
broken << ["team3",0,1,"team4"]
puts broken.render(:unicode, indent: 12)
┌─────┬─┬─┬─────┐
│Home │H│A│Away │
├─────┼─┼─┼─────┤
│team1│1│2│team2│
│team3│0│1│team4│
└─────┴─┴─┴─────┘
┌─────┬─┬─┬─────┐
│team1│1│2│team2│
│team3│0│1│team4│
└─────┴─┴─┴─────┘
Requirements
- [X] Tests written & passing locally?
- [X] Code style checked?
- [ ] Rebased with
masterbranch? - [X] Documentation updated?
- [X] Changelog updated?
This has failed at appveyor because of a github connectivity issue rather than a test failure. I don't know how to re-run the job so I will push a trivial change.