Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "node-fzf", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "fzf ( junegunn/fzf ) inspired cli utility for node", | ||
@@ -40,2 +40,3 @@ "main": "src/index.js", | ||
"redstar": "0.0.2", | ||
"string-width": "~2.1.1", | ||
"ttys": "0.0.3" | ||
@@ -42,0 +43,0 @@ }, |
@@ -8,2 +8,4 @@ const keypress = require( 'keypress' ) | ||
const stringWidth = require( 'string-width' ) | ||
const clc = require( 'cli-color' ) | ||
@@ -232,3 +234,3 @@ | ||
const len = t.length | ||
let len = stringWidth( t ) // use string-width to keep length in check | ||
const maxLen = getMaxWidth() // terminal width | ||
@@ -242,3 +244,3 @@ | ||
// limit too much unnecessary empty margin | ||
if ( matchMarginRight > ( t.length + 8 ) ) matchMarginRight = ( t.length + 8 ) | ||
if ( matchMarginRight > ( len + 8 ) ) matchMarginRight = ( len + 8 ) | ||
@@ -248,3 +250,3 @@ const shiftRight = ( maxLen - matchMarginRight ) | ||
let startIndex = 0 | ||
let endIndex = t.length | ||
let endIndex = len | ||
@@ -259,3 +261,4 @@ if ( shiftRight < 0 ) { | ||
if ( t.length > maxLen ) { | ||
len = stringWidth( t ) | ||
if ( len > maxLen ) { | ||
t = t.slice( 0, maxLen ) + '...' | ||
@@ -262,0 +265,0 @@ endIndex = maxLen |
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
11581
358
6
+ Addedstring-width@~2.1.1
+ Addedansi-regex@3.0.1(transitive)
+ Addedis-fullwidth-code-point@2.0.0(transitive)
+ Addedstring-width@2.1.1(transitive)
+ Addedstrip-ansi@4.0.0(transitive)