File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,16 +14,26 @@ const ctrlU = { ctrl: true, name: 'u' };
1414 prompt : ''
1515 } ) ;
1616
17- for ( const [ cursor , string ] of [
17+ const tests = [
1818 [ 1 , 'a' ] ,
1919 [ 2 , 'ab' ] ,
20- [ 2 , '丁' ] ,
21- [ 0 , '\u0301' ] , // COMBINING ACUTE ACCENT
22- [ 1 , 'a\u0301' ] , // á
23- [ 0 , '\u20DD' ] , // COMBINING ENCLOSING CIRCLE
24- [ 2 , 'a\u20DDb' ] , // a⃝b
25- [ 0 , '\u200E' ] // LEFT-TO-RIGHT MARK
26- ] ) {
20+ [ 2 , '丁' ]
21+ ] ;
22+
23+ // The non-ICU JS implementation of character width calculation is only aware
24+ // of the wide/narrow distinction. Only test these more advanced cases when
25+ // ICU is available.
26+ if ( process . binding ( 'config' ) . hasIntl ) {
27+ tests . push (
28+ [ 0 , '\u0301' ] , // COMBINING ACUTE ACCENT
29+ [ 1 , 'a\u0301' ] , // á
30+ [ 0 , '\u20DD' ] , // COMBINING ENCLOSING CIRCLE
31+ [ 2 , 'a\u20DDb' ] , // a⃝b
32+ [ 0 , '\u200E' ] // LEFT-TO-RIGHT MARK
33+ ) ;
34+ }
35+
36+ for ( const [ cursor , string ] of tests ) {
2737 rl . write ( string ) ;
2838 assert . strictEqual ( rl . _getCursorPos ( ) . cols , cursor ) ;
2939 rl . write ( null , ctrlU ) ;
You can’t perform that action at this time.
0 commit comments