File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -532,6 +532,14 @@ export const groupMultiselect = <Options extends Option<Value>[], Value>(
532
532
} ;
533
533
534
534
const strip = ( str : string ) => str . replace ( ansiRegex ( ) , '' ) ;
535
+ const strLength = ( str : string ) => {
536
+ let len = 0 ;
537
+ const arr = [ ...str ] ;
538
+ for ( const char of arr ) {
539
+ len += char . charCodeAt ( 0 ) > 127 || char . charCodeAt ( 0 ) === 94 ? 2 : 1 ;
540
+ }
541
+ return len ;
542
+ } ;
535
543
export const note = ( message = '' , title = '' ) => {
536
544
const lines = `\n${ message } \n` . split ( '\n' ) ;
537
545
const len =
@@ -540,7 +548,7 @@ export const note = (message = '', title = '') => {
540
548
ln = strip ( ln ) ;
541
549
return ln . length > sum ? ln . length : sum ;
542
550
} , 0 ) ,
543
- strip ( title ) . length
551
+ strLength ( strip ( title ) )
544
552
) + 2 ;
545
553
const msg = lines
546
554
. map (
@@ -552,7 +560,7 @@ export const note = (message = '', title = '') => {
552
560
. join ( '\n' ) ;
553
561
process . stdout . write (
554
562
`${ color . gray ( S_BAR ) } \n${ color . green ( S_STEP_SUBMIT ) } ${ color . reset ( title ) } ${ color . gray (
555
- S_BAR_H . repeat ( Math . max ( len - title . length - 1 , 1 ) ) + S_CORNER_TOP_RIGHT
563
+ S_BAR_H . repeat ( Math . max ( len - strLength ( title ) - 1 , 1 ) ) + S_CORNER_TOP_RIGHT
556
564
) } \n${ msg } \n${ color . gray ( S_CONNECT_LEFT + S_BAR_H . repeat ( len + 2 ) + S_CORNER_BOTTOM_RIGHT ) } \n`
557
565
) ;
558
566
} ;
You can’t perform that action at this time.
0 commit comments