Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

Commit

Permalink
fix cell render: rowSpan to the left of non-rowSpan cells.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestalmage committed Dec 16, 2014
1 parent db45939 commit 03f95b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,14 @@ Cell.prototype._topLeftChar = function(offset){
else {
leftChar = offset == 0 ? 'mid-mid' : 'bottom-mid';
if(this.cells){ //TODO: cells should always exist - some tests don't fill it in though
var cellAbove = this.cells[this.y-1][x];
if(cellAbove instanceof Cell.NoOpCell){
var spanAbove = this.cells[this.y-1][x] instanceof Cell.NoOpCell;
var spanLeft = offset == 0 && this.cells[this.y][x-1] instanceof Cell.RowSpanCell;
if(spanAbove){
leftChar = offset == 0 ? 'top-mid' : 'mid';
}
if(spanLeft){
leftChar = 'left-mid';
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/table-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Table', function () {
var expected = [
'┌───────────┬───────────┬───────┐'
, '│ greetings │ greetings │ hello │'
, '│ │ ───────┤'
, '│ │ ───────┤'
, '│ │ │ howdy │'
, '└───────────┴───────────┴───────┘'
];
Expand Down

0 comments on commit 03f95b7

Please sign in to comment.