Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
action = options.root.str.column( options.root.wrapOptions.x ) + action ;
}
options.root.wrapOptions.continue = true ;
options.root.wrapOptions.offset = wrapOptions.offset ;
}
else {
wrapOptions = {
width: options.root.wrapOptions.width || options.root.width ,
glue: '\n' ,
offset: options.root.wrapOptions.offset ,
updateOffset: true ,
skipFn: termkit.escapeSequenceSkipFn
} ;
action = string.wordwrap( action , wrapOptions ) ;
options.root.wrapOptions.continue = true ;
options.root.wrapOptions.offset = wrapOptions.offset ;
}
}
else {
// All non-wrapped string display reset the offset
options.root.wrapOptions.continue = false ;
options.root.wrapOptions.offset = 0 ;
}
off = options.offHasFormatting ? options.root.format( options.off ) : options.off ;
if ( options.forceStyleOnReset ) {
action = action.replace( new RegExp( string.escape.regExp( options.root.optimized.styleReset ) , 'g' ) , options.root.optimized.styleReset + on ) ;
}
menuItems = menuItems_.map( ( element , index ) => {
var item , lines ,
lineLength = options.itemMaxWidth - paddingLength ;
lines = string.wordwrap( element , {
width: lineLength ,
noJoin: true ,
fill: true ,
skipFn: termkit.escapeSequenceSkipFn
} ) ;
item = {
offsetY: offsetY ,
index: index ,
text: element ,
displayText: lines
} ;
offsetY += lines.length ;
return item ;
Element.wordwrapContent = ( content , width , hasMarkup ) =>
hasMarkup ? misc.wordwrapMarkup( content , width ) : string.wordwrap( content , { width , fill: true , noJoin: true } ) ;
misc.wordwrapMarkup = ( str , width ) => string.wordwrap( str , {
width: width ,
noJoin: true ,
fill: true ,
regroupFn: strArray => {
var markup = '' ,
complexMarkup = false ,
newStrArray = [] ;
strArray.forEach( char => {
if ( complexMarkup ) {
markup += char ;
if ( char === ']' ) {
newStrArray.push( markup ) ;
markup = '' ;
complexMarkup = false ;