File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -344,14 +344,11 @@ export class Text extends Shape {
344344 return this . splitInWords ( ) ;
345345 }
346346
347- private pushSeparatorInWords ( pickedChars : number ) : [ string , number ] {
348- return [ this . text [ pickedChars ] , pickedChars + 1 ]
349- }
350-
351347 private buildWord ( pickedChars : number , word : string ) : [ string , number ] {
352- while ( ! C . TEXT_SEPARATORS . includes ( this . text [ pickedChars ] ) && pickedChars < this . text . length ) {
348+ while ( pickedChars < this . text . length ) {
353349 word += this . text [ pickedChars ] ;
354350 pickedChars ++ ;
351+ if ( C . TEXT_SEPARATORS . includes ( word [ word . length - 1 ] ) ) break ;
355352 }
356353 return [ word , pickedChars ]
357354 }
@@ -361,8 +358,7 @@ export class Text extends Shape {
361358 let pickedChars = 0 ;
362359 while ( pickedChars < this . text . length ) {
363360 let word = "" ;
364- if ( C . TEXT_SEPARATORS . includes ( this . text [ pickedChars ] ) ) [ word , pickedChars ] = this . pushSeparatorInWords ( pickedChars )
365- else [ word , pickedChars ] = this . buildWord ( pickedChars , word ) ;
361+ [ word , pickedChars ] = this . buildWord ( pickedChars , word ) ;
366362 words . push ( word ) ;
367363 }
368364 return words . length > 1 ? words : this . text . split ( "" )
You can’t perform that action at this time.
0 commit comments