File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -532,6 +532,14 @@ export const groupMultiselect = <Options extends Option<Value>[], Value>(
532532} ;
533533
534534const 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+ } ;
535543export const note = ( message = '' , title = '' ) => {
536544 const lines = `\n${ message } \n` . split ( '\n' ) ;
537545 const len =
@@ -552,7 +560,7 @@ export const note = (message = '', title = '') => {
552560 . join ( '\n' ) ;
553561 process . stdout . write (
554562 `${ 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
556564 ) } \n${ msg } \n${ color . gray ( S_CONNECT_LEFT + S_BAR_H . repeat ( len + 2 ) + S_CORNER_BOTTOM_RIGHT ) } \n`
557565 ) ;
558566} ;
You can’t perform that action at this time.
0 commit comments