@@ -73,7 +73,7 @@ export function Cell(props: CellProps) {
7373 ) }
7474 { collapsed && depth === undefined && < span className = { 'unipika' } > ...</ span > }
7575 { close && < OpenClose type = { close } settings = { settings } close /> }
76- { hasDelimiter && < SlaveText text = { ',' } /> }
76+ { hasDelimiter && < AdditionalText text = { ',' } /> }
7777 </ div >
7878 ) ;
7979}
@@ -90,7 +90,7 @@ function Key(props: KeyProps) {
9090 return text ? (
9191 < React . Fragment >
9292 { text }
93- < SlaveText text = { ': ' } />
93+ < AdditionalText text = { ': ' } />
9494 </ React . Fragment >
9595 ) : null ;
9696}
@@ -117,7 +117,8 @@ function renderValueWithFilter(props: ValueProps, className: string) {
117117function renderStringWithFilter ( props : ValueProps , className : string , maxWidth = Infinity ) {
118118 const { text, settings = defaultUnipikaSettings , matched = [ ] , filter, showFullText} = props ;
119119 const tmp = unipika . format ( text , { ...settings , asHTML : false } ) ;
120- const visible = tmp . substr ( 1 , Math . min ( tmp . length - 2 , maxWidth ) ) ;
120+ const length = tmp . length ;
121+ const visible = tmp . substring ( 1 , Math . min ( length - 1 , maxWidth + 1 ) ) ;
121122 const truncated = visible . length < tmp . length - 2 ;
122123 let hasHiddenMatch = false ;
123124 if ( truncated ) {
@@ -178,17 +179,17 @@ function renderWithFilter(props: KeyProps, className: string) {
178179 return res ? res : null ;
179180}
180181
181- function SlaveText ( { text} : { text : string } ) {
182- return < span className = { '' } > { text } </ span > ;
182+ function AdditionalText ( { text} : { text : string } ) {
183+ return < span > { text } </ span > ;
183184}
184185
185186function OpenClose ( props : { type : BlockType ; close ?: boolean ; settings ?: UnipikaSettings } ) {
186187 const { type, close} = props ;
187188 switch ( type ) {
188189 case 'array' :
189- return < SlaveText text = { close ? ']' : '[' } /> ;
190+ return < AdditionalText text = { close ? ']' : '[' } /> ;
190191 case 'object' :
191- return < SlaveText text = { close ? '}' : '{' } /> ;
192+ return < AdditionalText text = { close ? '}' : '{' } /> ;
192193 }
193194}
194195
0 commit comments