@@ -48,12 +48,12 @@ const {
4848 NumberIsNaN,
4949 ObjectDefineProperty,
5050 ObjectSetPrototypeOf,
51- RegExpPrototypeTest,
51+ RegExpPrototypeExec,
52+ RegExpPrototypeSymbolReplace,
53+ RegExpPrototypeSymbolSplit,
5254 StringPrototypeCodePointAt,
5355 StringPrototypeEndsWith,
54- StringPrototypeMatch,
5556 StringPrototypeRepeat,
56- StringPrototypeReplace,
5757 StringPrototypeSlice,
5858 StringPrototypeSplit,
5959 StringPrototypeStartsWith,
@@ -642,12 +642,12 @@ Interface.prototype._normalWrite = function(b) {
642642 let string = this . _decoder . write ( b ) ;
643643 if ( this . _sawReturnAt &&
644644 DateNow ( ) - this . _sawReturnAt <= this . crlfDelay ) {
645- string = StringPrototypeReplace ( string , / ^ \n / , '' ) ;
645+ string = RegExpPrototypeSymbolReplace ( / ^ \n / , string , '' ) ;
646646 this . _sawReturnAt = 0 ;
647647 }
648648
649649 // 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 ;
651651
652652 if ( this . _line_buffer ) {
653653 string = this . _line_buffer + string ;
@@ -773,7 +773,7 @@ Interface.prototype._wordLeft = function() {
773773 const leading = StringPrototypeSlice ( this . line , 0 , this . cursor ) ;
774774 const reversed = ArrayPrototypeJoin (
775775 ArrayPrototypeReverse ( ArrayFrom ( leading ) ) , '' ) ;
776- const match = StringPrototypeMatch ( reversed , / ^ \s * (?: [ ^ \w \s ] + | \w + ) ? / ) ;
776+ const match = RegExpPrototypeExec ( / ^ \s * (?: [ ^ \w \s ] + | \w + ) ? / , reversed ) ;
777777 this . _moveCursor ( - match [ 0 ] . length ) ;
778778 }
779779} ;
@@ -782,7 +782,7 @@ Interface.prototype._wordLeft = function() {
782782Interface . prototype . _wordRight = function ( ) {
783783 if ( this . cursor < this . line . length ) {
784784 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 ) ;
786786 this . _moveCursor ( match [ 0 ] . length ) ;
787787 }
788788} ;
@@ -818,7 +818,7 @@ Interface.prototype._deleteWordLeft = function() {
818818 let leading = StringPrototypeSlice ( this . line , 0 , this . cursor ) ;
819819 const reversed = ArrayPrototypeJoin (
820820 ArrayPrototypeReverse ( ArrayFrom ( leading ) ) , '' ) ;
821- const match = StringPrototypeMatch ( reversed , / ^ \s * (?: [ ^ \w \s ] + | \w + ) ? / ) ;
821+ const match = RegExpPrototypeExec ( / ^ \s * (?: [ ^ \w \s ] + | \w + ) ? / , reversed ) ;
822822 leading = StringPrototypeSlice ( leading , 0 ,
823823 leading . length - match [ 0 ] . length ) ;
824824 this . line = leading + StringPrototypeSlice ( this . line , this . cursor ,
@@ -832,7 +832,7 @@ Interface.prototype._deleteWordLeft = function() {
832832Interface . prototype . _deleteWordRight = function ( ) {
833833 if ( this . cursor < this . line . length ) {
834834 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 ) ;
836836 this . line = StringPrototypeSlice ( this . line , 0 , this . cursor ) +
837837 StringPrototypeSlice ( trailing , match [ 0 ] . length ) ;
838838 this . _refreshLine ( ) ;
@@ -1272,7 +1272,7 @@ Interface.prototype._ttyWrite = function(s, key) {
12721272 // falls through
12731273 default :
12741274 if ( typeof s === 'string' && s ) {
1275- const lines = StringPrototypeSplit ( s , / \r \n | \n | \r / ) ;
1275+ const lines = RegExpPrototypeSymbolSplit ( / \r \n | \n | \r / , s ) ;
12761276 for ( let i = 0 , len = lines . length ; i < len ; i ++ ) {
12771277 if ( i > 0 ) {
12781278 this . _line ( ) ;
0 commit comments