Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

terminal-kit

Package Overview
Dependencies
Maintainers
1
Versions
638
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terminal-kit - npm Package Compare versions

Comparing version 2.10.3 to 2.10.4

40

lib/document/EditableTextBox.js

@@ -456,3 +456,3 @@ /*

this.textBuffer.moveBackward() ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;

@@ -463,3 +463,3 @@ } ;

this.textBuffer.moveForward() ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;

@@ -470,3 +470,3 @@ } ;

this.textBuffer.moveToStartOfWord() ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;

@@ -477,3 +477,3 @@ } ;

this.textBuffer.moveToEndOfWord() ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;

@@ -484,3 +484,3 @@ } ;

this.textBuffer.moveToColumn( 0 ) ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;

@@ -491,3 +491,3 @@ } ;

this.textBuffer.moveToEndOfLine() ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;

@@ -498,3 +498,3 @@ } ;

this.textBuffer.moveDown() ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;

@@ -505,3 +505,3 @@ } ;

this.textBuffer.moveUp() ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;

@@ -512,3 +512,3 @@ } ;

this.textBuffer.moveLeft() ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;

@@ -519,3 +519,3 @@ } ;

this.textBuffer.moveRight() ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;

@@ -527,6 +527,15 @@ } ;

this.textBuffer.move( 0 , -dy ) ;
this.scroll( 0 , dy ) ;
this.scroll( 0 , dy , true ) ; this.autoScrollAndDraw() ;
//this.scroll( 0 , dy ) ; this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;
} ;
userActions.scrollDown = function() {
var dy = -Math.ceil( this.outputHeight / 2 ) ;
this.textBuffer.move( 0 , -dy ) ;
this.scroll( 0 , dy , true ) ; this.autoScrollAndDraw() ;
//this.scroll( 0 , dy ) ; this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;
} ;
userActions.scrollTop = function() {

@@ -540,13 +549,6 @@ this.textBuffer.moveTo( 0 , 0 ) ;

this.textBuffer.moveTo( 0 , this.textBuffer.buffer.length - 1 ) ;
this.autoScrollAndDrawCursor() ;
this.autoScrollAndSmartDraw() ;
this.emit( 'cursorMove' ) ;
} ;
userActions.scrollDown = function() {
var dy = -Math.ceil( this.outputHeight / 2 ) ;
this.textBuffer.move( 0 , -dy ) ;
this.scroll( 0 , dy ) ;
this.emit( 'cursorMove' ) ;
} ;
userActions.scrollToCursor = function() {

@@ -553,0 +555,0 @@ this.autoScrollAndDraw() ;

@@ -281,2 +281,14 @@ /*

Slider.prototype.getValue = function() {
return this.rateToValue( this.slideRate ) ;
} ;
Slider.prototype.setValue = function( value , internalAndNoDraw ) {
return this.setSlideRate( this.valueToRate( value ) , internalAndNoDraw ) ;
} ;
Slider.prototype.getHandleOffset = function() { return this.handleOffset ; } ;

@@ -300,14 +312,2 @@ Slider.prototype.getSlideRate = function() { return this.slideRate ; } ;

Slider.prototype.getValue = function() {
return this.rateToValue( this.slideRate ) ;
} ;
Slider.prototype.setValue = function( value , internalAndNoDraw ) {
return this.setSlideRate( this.valueToRate( value ) , internalAndNoDraw ) ;
} ;
Slider.prototype.onClick = function( data ) {

@@ -314,0 +314,0 @@ if ( ! this.hasFocus ) { this.document.giveFocusTo( this , 'select' ) ; }

@@ -70,2 +70,5 @@ /*

this.autoScrollContextLines = options.autoScrollContextLines ?? 0 ;
this.autoScrollContextColumns = options.autoScrollContextColumns ?? 1 ;
// Right shift of the first-line, may be useful for prompt, or continuing another box in the flow

@@ -287,21 +290,2 @@ this.firstLineRightShift = options.firstLineRightShift || 0 ;

TextBox.prototype.scroll = function( dx , dy , dontDraw = false ) {
return this.scrollTo( dx ? this.scrollX + dx : null , dy ? this.scrollY + dy : null , dontDraw ) ;
} ;
TextBox.prototype.scrollToTop = function( dontDraw = false ) {
return this.scrollTo( null , 0 , dontDraw ) ;
} ;
TextBox.prototype.scrollToBottom = function( dontDraw = false ) {
// Ignore extra scrolling here
return this.scrollTo( null , this.textAreaHeight - this.textBuffer.buffer.length , dontDraw ) ;
} ;
TextBox.prototype.scrollTo = function( x , y , noDraw = false ) {

@@ -338,21 +322,39 @@ if ( ! this.scrollable ) { return ; }

TextBox.prototype.scroll = function( dx , dy , dontDraw = false ) {
return this.scrollTo( dx ? this.scrollX + dx : null , dy ? this.scrollY + dy : null , dontDraw ) ;
} ;
TextBox.prototype.scrollToTop = function( dontDraw = false ) {
return this.scrollTo( null , 0 , dontDraw ) ;
} ;
TextBox.prototype.autoScrollAndDraw = function( onlyDrawCursor = false ) {
var x , y ;
TextBox.prototype.scrollToBottom = function( dontDraw = false ) {
// Ignore extra scrolling here
return this.scrollTo( null , this.textAreaHeight - this.textBuffer.buffer.length , dontDraw ) ;
} ;
// We use cx-1 because at least we want to see the char just before the cursor (backspace, etc...)
// But do nothing if there is no scrolling yet (do not set x to 0 if it's unnecessary)
if ( this.textBuffer.cx - 1 < -this.scrollX && this.scrollX !== 0 ) {
x = -Math.max( 0 , this.textBuffer.cx - 1 ) ;
TextBox.prototype.autoScrollAndDraw = function( onlyDrawCursorExceptIfScrolled = false , noDraw = false ) {
var x , y ,
contextColumns = Math.min( Math.floor( this.textAreaWidth / 2 ) , this.autoScrollContextColumns ) ,
contextLines = Math.min( Math.floor( this.textAreaHeight / 2 ) , this.autoScrollContextLines ) ;
// Do nothing if there is no scrolling yet (do not set x to 0 if it's unnecessary)
if ( this.textBuffer.cx < -this.scrollX + contextColumns && this.scrollX !== 0 ) {
// The cursor will be on left of the viewport
x = Math.min( 0 , -this.textBuffer.cx + contextColumns ) ;
}
else if ( this.textBuffer.cx > this.textAreaWidth - this.scrollX - 1 ) {
x = this.textAreaWidth - 1 - this.textBuffer.cx ;
else if ( this.textBuffer.cx > this.textAreaWidth - this.scrollX - 1 - contextColumns ) {
// The cursor will be on right of the viewport
x = this.textAreaWidth - 1 - this.textBuffer.cx - contextColumns ;
}
if ( this.textBuffer.cy < -this.scrollY ) {
y = -this.textBuffer.cy ;
if ( this.textBuffer.cy < -this.scrollY + contextLines ) {
// The cursor will be on top of the viewport
y = Math.min( 0 , -this.textBuffer.cy + contextLines ) ;
}
else if ( this.textBuffer.cy > this.textAreaHeight - this.scrollY - 1 ) {
y = this.textAreaHeight - 1 - this.textBuffer.cy ;
else if ( this.textBuffer.cy > this.textAreaHeight - this.scrollY - 1 - contextLines ) {
// The cursor will be at the bottom of the viewport
y = this.textAreaHeight - 1 - this.textBuffer.cy - contextLines ;
}

@@ -362,5 +364,5 @@

// .scrollTo() call .draw(), so no need to do that here...
this.scrollTo( x , y ) ;
this.scrollTo( x , y , noDraw ) ;
}
else if ( ! onlyDrawCursor ) {
else if ( ! onlyDrawCursorExceptIfScrolled ) {
this.draw() ;

@@ -373,3 +375,3 @@ }

TextBox.prototype.autoScrollAndDrawCursor = function() { return this.autoScrollAndDraw( true ) ; } ;
TextBox.prototype.autoScrollAndSmartDraw = function() { return this.autoScrollAndDraw( true ) ; } ;

@@ -376,0 +378,0 @@

{
"name": "terminal-kit",
"version": "2.10.3",
"version": "2.10.4",
"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!",

@@ -5,0 +5,0 @@ "main": "lib/termkit.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc