terminal-kit
Advanced tools
Comparing version 2.11.0 to 2.11.1
@@ -1777,4 +1777,5 @@ /* | ||
// TODOC | ||
// Return a region where the searchString is found | ||
TextBuffer.prototype.findNext = function( searchString , startPosition , reverse ) { | ||
var index , startAt , endAt , nextArgs , | ||
var index , startAt , endAt , | ||
text = this.getText() , | ||
@@ -1786,3 +1787,2 @@ // /!\ another function MUST BE used once unicode composition will be supported | ||
reverse = !! reverse ; | ||
startPosition = startPosition ?? ( reverse ? text.length : 0 ) ; | ||
@@ -1821,2 +1821,42 @@ if ( reverse ) { | ||
// TODOC | ||
// Return a region where the regexp match, the region also have a 'match' property with the result of the regexp#exec(). | ||
// Can't be reversed due to how regexp works, except by searching for all match beforehand | ||
TextBuffer.prototype.regexpFindNext = function( regexp , startPosition = 0 ) { | ||
var index , startAt , endAt , size , match , | ||
text = this.getText() ; | ||
if ( typeof regexp === 'string' ) { | ||
regexp = new RegExp( regexp , 'gu' ) ; | ||
} | ||
else { | ||
// Force global and unicode | ||
regexp.global = true ; | ||
regexp.unicode = true ; | ||
} | ||
regexp.lastIndex = startPosition ; | ||
match = regexp.exec( text ) ; | ||
if ( ! match ) { return ; } | ||
// /!\ another function MUST BE used once unicode composition will be supported | ||
// It is meant to produce the exact same cell size | ||
size = string.unicode.toArray( match[ 0 ] ).length ; | ||
startAt = this.offsetToCoordinate( match.index ) ; | ||
endAt = this.offsetToCoordinate( match.index + size - 1 ) ; | ||
return { | ||
xmin: startAt.x , | ||
ymin: startAt.y , | ||
xmax: endAt.x , | ||
ymax: endAt.y , | ||
match | ||
} ; | ||
} ; | ||
/* | ||
@@ -1823,0 +1863,0 @@ A TextBuffer can only draw to a ScreenBuffer. |
{ | ||
"name": "terminal-kit", | ||
"version": "2.11.0", | ||
"version": "2.11.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!", | ||
@@ -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
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
4841143
83288