@@ -48,12 +48,12 @@ const {
48
48
NumberIsNaN,
49
49
ObjectDefineProperty,
50
50
ObjectSetPrototypeOf,
51
- RegExpPrototypeTest,
51
+ RegExpPrototypeExec,
52
+ RegExpPrototypeSymbolReplace,
53
+ RegExpPrototypeSymbolSplit,
52
54
StringPrototypeCodePointAt,
53
55
StringPrototypeEndsWith,
54
- StringPrototypeMatch,
55
56
StringPrototypeRepeat,
56
- StringPrototypeReplace,
57
57
StringPrototypeSlice,
58
58
StringPrototypeSplit,
59
59
StringPrototypeStartsWith,
@@ -642,12 +642,12 @@ Interface.prototype._normalWrite = function(b) {
642
642
let string = this . _decoder . write ( b ) ;
643
643
if ( this . _sawReturnAt &&
644
644
DateNow ( ) - this . _sawReturnAt <= this . crlfDelay ) {
645
- string = StringPrototypeReplace ( string , / ^ \n / , '' ) ;
645
+ string = RegExpPrototypeSymbolReplace ( / ^ \n / , string , '' ) ;
646
646
this . _sawReturnAt = 0 ;
647
647
}
648
648
649
649
// Run test() on the new string chunk, not on the entire line buffer.
650
- const newPartContainsEnding = RegExpPrototypeTest ( lineEnding , string ) ;
650
+ const newPartContainsEnding = RegExpPrototypeExec ( lineEnding , string ) !== null ;
651
651
652
652
if ( this . _line_buffer ) {
653
653
string = this . _line_buffer + string ;
@@ -773,7 +773,7 @@ Interface.prototype._wordLeft = function() {
773
773
const leading = StringPrototypeSlice ( this . line , 0 , this . cursor ) ;
774
774
const reversed = ArrayPrototypeJoin (
775
775
ArrayPrototypeReverse ( ArrayFrom ( leading ) ) , '' ) ;
776
- const match = StringPrototypeMatch ( reversed , / ^ \s * (?: [ ^ \w \s ] + | \w + ) ? / ) ;
776
+ const match = RegExpPrototypeExec ( / ^ \s * (?: [ ^ \w \s ] + | \w + ) ? / , reversed ) ;
777
777
this . _moveCursor ( - match [ 0 ] . length ) ;
778
778
}
779
779
} ;
@@ -782,7 +782,7 @@ Interface.prototype._wordLeft = function() {
782
782
Interface . prototype . _wordRight = function ( ) {
783
783
if ( this . cursor < this . line . length ) {
784
784
const trailing = StringPrototypeSlice ( this . line , this . cursor ) ;
785
- const match = StringPrototypeMatch ( trailing , / ^ (?: \s + | [ ^ \w \s ] + | \w + ) \s * / ) ;
785
+ const match = RegExpPrototypeExec ( / ^ (?: \s + | [ ^ \w \s ] + | \w + ) \s * / , trailing ) ;
786
786
this . _moveCursor ( match [ 0 ] . length ) ;
787
787
}
788
788
} ;
@@ -818,7 +818,7 @@ Interface.prototype._deleteWordLeft = function() {
818
818
let leading = StringPrototypeSlice ( this . line , 0 , this . cursor ) ;
819
819
const reversed = ArrayPrototypeJoin (
820
820
ArrayPrototypeReverse ( ArrayFrom ( leading ) ) , '' ) ;
821
- const match = StringPrototypeMatch ( reversed , / ^ \s * (?: [ ^ \w \s ] + | \w + ) ? / ) ;
821
+ const match = RegExpPrototypeExec ( / ^ \s * (?: [ ^ \w \s ] + | \w + ) ? / , reversed ) ;
822
822
leading = StringPrototypeSlice ( leading , 0 ,
823
823
leading . length - match [ 0 ] . length ) ;
824
824
this . line = leading + StringPrototypeSlice ( this . line , this . cursor ,
@@ -832,7 +832,7 @@ Interface.prototype._deleteWordLeft = function() {
832
832
Interface . prototype . _deleteWordRight = function ( ) {
833
833
if ( this . cursor < this . line . length ) {
834
834
const trailing = StringPrototypeSlice ( this . line , this . cursor ) ;
835
- const match = StringPrototypeMatch ( trailing , / ^ (?: \s + | \W + | \w + ) \s * / ) ;
835
+ const match = RegExpPrototypeExec ( / ^ (?: \s + | \W + | \w + ) \s * / , trailing ) ;
836
836
this . line = StringPrototypeSlice ( this . line , 0 , this . cursor ) +
837
837
StringPrototypeSlice ( trailing , match [ 0 ] . length ) ;
838
838
this . _refreshLine ( ) ;
@@ -1272,7 +1272,7 @@ Interface.prototype._ttyWrite = function(s, key) {
1272
1272
// falls through
1273
1273
default :
1274
1274
if ( typeof s === 'string' && s ) {
1275
- const lines = StringPrototypeSplit ( s , / \r \n | \n | \r / ) ;
1275
+ const lines = RegExpPrototypeSymbolSplit ( / \r \n | \n | \r / , s ) ;
1276
1276
for ( let i = 0 , len = lines . length ; i < len ; i ++ ) {
1277
1277
if ( i > 0 ) {
1278
1278
this . _line ( ) ;
0 commit comments