Skip to content

Commit

Permalink
TextTable fix: when providing a custom 'borderChars', check that all …
Browse files Browse the repository at this point in the history
…character types exists (#173)
  • Loading branch information
cronvel committed May 8, 2021
1 parent 74b30c1 commit ac1b3da
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

v2.1.1
------

TextTable fix: when providing a custom 'borderChars', check that all character types exists (#173)


v2.1.0
------

Expand Down
2 changes: 1 addition & 1 deletion lib/document/TextTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function TextTable( options ) {
this.borderChars = boxesChars.light ;

if ( typeof options.borderChars === 'object' ) {
this.borderChars = options.borderChars ;
this.borderChars = boxesChars.__fix__( options.borderChars ) ;
}
else if ( typeof options.borderChars === 'string' && boxesChars[ options.borderChars ] ) {
this.borderChars = boxesChars[ options.borderChars ] ;
Expand Down
13 changes: 13 additions & 0 deletions lib/spChars.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ module.exports = {

// When editing this, update spChars.md doc
box: {
__fix__: object => ( {
vertical: object.vertical || ' ' ,
horizontal: object.horizontal || ' ' ,
topLeft: object.topLeft || ' ' ,
topRight: object.topRight || ' ' ,
bottomLeft: object.bottomLeft || ' ' ,
bottomRight: object.bottomRight || ' ' ,
topTee: object.topTee || ' ' ,
bottomTee: object.bottomTee || ' ' ,
leftTee: object.leftTee || ' ' ,
rightTee: object.rightTee || ' ' ,
cross: object.cross || ' '
} ) ,
plain: {
vertical: '█' ,
horizontal: '█' ,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "terminal-kit",
"version": "2.1.0",
"version": "2.1.1",
"description": "256 colors, keys and mouse, input field, progress bars, screen buffer (including 32-bit composition and image loading), text buffer, and many more... Whether you just need colors and styles, build a simple interactive command line tool or a complexe terminal app: this is the absolute terminal lib for Node.js!",
"main": "lib/termkit.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion sample/document/text-table-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var textTable = new termkit.TextTable( {
//lineWrap: true ,
} ) ;

/*
//*
setTimeout( () => {
textTable.setCellContent( 2 , 3 , "New ^R^+content^:! And BTW... We have to force some line break and so on..." ) ;
} , 1000 ) ;
Expand Down

0 comments on commit ac1b3da

Please sign in to comment.