terminal-kit
Advanced tools
Comparing version 2.11.7 to 3.0.0
@@ -33,3 +33,5 @@ /* | ||
const TextBox = require( './TextBox.js' ) ; | ||
const string = require( 'string-kit' ) ; | ||
const Promise = require( 'seventh' ) ; | ||
@@ -51,2 +53,7 @@ | ||
this.debounceTimeout = options.debounceTimeout ?? 100 ; | ||
this.editionUpdateDebounced = | ||
this.debounceTimeout ? Promise.debounceUpdate( { delay: this.debounceTimeout } , this.editionUpdate ) : | ||
this.editionUpdate ; | ||
if ( options.keyBindings ) { this.keyBindings = options.keyBindings ; } | ||
@@ -131,6 +138,2 @@ | ||
if ( ! internal ) { | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
if ( selectIt ) { | ||
@@ -142,3 +145,3 @@ this.textBuffer.setSelectionRegion( { | ||
this.autoScrollAndDraw() ; | ||
this.editionUpdateDebounced() ; | ||
} | ||
@@ -174,6 +177,3 @@ else if ( selectIt ) { | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
this.autoScrollAndDraw() ; | ||
this.editionUpdateDebounced() ; | ||
} | ||
@@ -203,6 +203,3 @@ | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
this.autoScrollAndDraw() ; | ||
this.editionUpdateDebounced() ; | ||
} | ||
@@ -239,2 +236,17 @@ | ||
// Called when something was edited, usually requiring to run state machine, auto-scroll and draw. | ||
// Usually, editionUpdateDebounced is called instead. | ||
// Sync, but return a promise (needed for Promise.debounceUpdate()) | ||
EditableTextBox.prototype.editionUpdate = function() { | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
this.autoScrollAndDraw() ; | ||
return Promise.resolved ; | ||
} ; | ||
EditableTextBox.prototype.onFocus = function( focus , type ) { | ||
@@ -294,9 +306,3 @@ this.updateStatus() ; | ||
this.document.getSystemClipboard( 'primary' ).then( str => { | ||
if ( str ) { | ||
this.textBuffer.insert( str , this.textAttr ) ; | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
this.autoScrollAndDraw() ; | ||
} | ||
if ( str ) { this.insert( str ) ; } | ||
//else { this.drawCursor() ; } | ||
@@ -323,6 +329,5 @@ } ) | ||
var count = this.textBuffer.insert( key , this.textAttr ) ; | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
this.autoScrollAndDraw() ; | ||
this.editionUpdateDebounced() ; | ||
this.emit( 'change' , { | ||
@@ -346,6 +351,4 @@ type: 'insert' , | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
this.autoScrollAndDraw() ; | ||
this.editionUpdateDebounced() ; | ||
this.emit( 'change' , { | ||
@@ -366,6 +369,5 @@ type: 'insert' , | ||
this.textBuffer.insert( '\t' , this.textAttr ) ; | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
this.autoScrollAndDraw() ; | ||
this.editionUpdateDebounced() ; | ||
this.emit( 'change' , { | ||
@@ -393,7 +395,5 @@ type: 'insert' , | ||
var deleted = this.textBuffer.delete( 1 , true ) ; | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
this.autoScrollAndDraw() ; | ||
this.editionUpdateDebounced() ; | ||
if ( deleted && deleted.count ) { | ||
@@ -426,7 +426,5 @@ this.emit( 'change' , { | ||
var deleted = this.textBuffer.backDelete( 1 , true ) ; | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
this.autoScrollAndDraw() ; | ||
this.editionUpdateDebounced() ; | ||
if ( deleted && deleted.count ) { | ||
@@ -448,7 +446,5 @@ this.emit( 'change' , { | ||
var deleted = this.textBuffer.deleteLine( true ) ; | ||
if ( this.stateMachine ) { | ||
this.textBuffer.runStateMachine() ; | ||
} | ||
this.autoScrollAndDraw() ; | ||
this.editionUpdateDebounced() ; | ||
if ( deleted && deleted.count ) { | ||
@@ -805,1 +801,2 @@ this.emit( 'change' , { | ||
} ; | ||
{ | ||
"name": "terminal-kit", | ||
"version": "2.11.7", | ||
"version": "3.0.0", | ||
"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!", | ||
@@ -10,3 +10,3 @@ "main": "lib/termkit.js", | ||
"engines": { | ||
"node": ">=14.15.0" | ||
"node": ">=16.13.0" | ||
}, | ||
@@ -19,3 +19,3 @@ "dependencies": { | ||
"nextgen-events": "^1.5.3", | ||
"seventh": "^0.7.40", | ||
"seventh": "^0.8.1", | ||
"string-kit": "^0.17.6", | ||
@@ -22,0 +22,0 @@ "tree-kit": "^0.7.4" |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4855303
83522
+ Addedseventh@0.8.3(transitive)
- Removedseventh@0.7.40(transitive)
Updatedseventh@^0.8.1