Skip to content

Commit

Permalink
Fix TextBuffer#moveTo() not respecting 'forceInBound' property
Browse files Browse the repository at this point in the history
  • Loading branch information
cronvel committed Sep 22, 2022
1 parent 9fb28ce commit e76603d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

v2.11.7
-------

Fix TextBuffer#moveTo() not respecting 'forceInBound' property


v2.11.6
-------

Expand Down
7 changes: 4 additions & 3 deletions browser/termkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7298,6 +7298,7 @@ TextBuffer.prototype.moveToLeadingFullWidth = function() {
TextBuffer.prototype.moveTo = function( x , y ) {
this.cx = x >= 0 ? x : 0 ;
this.cy = y >= 0 ? y : 0 ;
if ( this.forceInBound ) { this.moveInBound( true ) ; }
this.moveToLeadingFullWidth() ;
} ;

Expand All @@ -7311,24 +7312,24 @@ TextBuffer.prototype.moveToLine = TextBuffer.prototype.moveToRow = function( y )

TextBuffer.prototype.moveUp = function() {
this.cy = this.cy > 0 ? this.cy - 1 : 0 ;
this.moveToLeadingFullWidth() ;
if ( this.forceInBound ) { this.moveInBound( true ) ; }
this.moveToLeadingFullWidth() ;
} ;



TextBuffer.prototype.moveDown = function() {
this.cy ++ ;
this.moveToLeadingFullWidth() ;
if ( this.forceInBound ) { this.moveInBound( true ) ; }
this.moveToLeadingFullWidth() ;
} ;



TextBuffer.prototype.moveLeft = function() {
this.cx = this.cx > 0 ? this.cx - 1 : 0 ;
this.moveToLeadingFullWidth() ;
if ( this.forceInBound ) { this.moveInBound( true ) ; }
this.moveToLeadingFullWidth() ;
} ;


Expand Down
2 changes: 1 addition & 1 deletion browser/termkit.min.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions lib/TextBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ TextBuffer.prototype.moveToLeadingFullWidth = function() {
TextBuffer.prototype.moveTo = function( x , y ) {
this.cx = x >= 0 ? x : 0 ;
this.cy = y >= 0 ? y : 0 ;
if ( this.forceInBound ) { this.moveInBound( true ) ; }
this.moveToLeadingFullWidth() ;
} ;

Expand All @@ -1145,24 +1146,24 @@ TextBuffer.prototype.moveToLine = TextBuffer.prototype.moveToRow = function( y )

TextBuffer.prototype.moveUp = function() {
this.cy = this.cy > 0 ? this.cy - 1 : 0 ;
this.moveToLeadingFullWidth() ;
if ( this.forceInBound ) { this.moveInBound( true ) ; }
this.moveToLeadingFullWidth() ;
} ;



TextBuffer.prototype.moveDown = function() {
this.cy ++ ;
this.moveToLeadingFullWidth() ;
if ( this.forceInBound ) { this.moveInBound( true ) ; }
this.moveToLeadingFullWidth() ;
} ;



TextBuffer.prototype.moveLeft = function() {
this.cx = this.cx > 0 ? this.cx - 1 : 0 ;
this.moveToLeadingFullWidth() ;
if ( this.forceInBound ) { this.moveInBound( true ) ; }
this.moveToLeadingFullWidth() ;
} ;


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.11.6",
"version": "2.11.7",
"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

0 comments on commit e76603d

Please sign in to comment.