@@ -43,7 +43,7 @@ const isFullWidthCodePoint = internalReadline.isFullWidthCodePoint;
43
43
const stripVTControlCharacters = internalReadline . stripVTControlCharacters ;
44
44
45
45
46
- exports . createInterface = function ( input , output , completer , terminal ) {
46
+ function createInterface ( input , output , completer , terminal ) {
47
47
return new Interface ( input , output , completer , terminal ) ;
48
48
} ;
49
49
@@ -311,13 +311,13 @@ Interface.prototype._refreshLine = function() {
311
311
// first move to the bottom of the current line, based on cursor pos
312
312
var prevRows = this . prevRows || 0 ;
313
313
if ( prevRows > 0 ) {
314
- exports . moveCursor ( this . output , 0 , - prevRows ) ;
314
+ moveCursor ( this . output , 0 , - prevRows ) ;
315
315
}
316
316
317
317
// Cursor to left edge.
318
- exports . cursorTo ( this . output , 0 ) ;
318
+ cursorTo ( this . output , 0 ) ;
319
319
// erase data
320
- exports . clearScreenDown ( this . output ) ;
320
+ clearScreenDown ( this . output ) ;
321
321
322
322
// Write the prompt and the current buffer content.
323
323
this . _writeToOutput ( line ) ;
@@ -328,11 +328,11 @@ Interface.prototype._refreshLine = function() {
328
328
}
329
329
330
330
// Move cursor to original position.
331
- exports . cursorTo ( this . output , cursorPos . cols ) ;
331
+ cursorTo ( this . output , cursorPos . cols ) ;
332
332
333
333
var diff = lineRows - cursorPos . rows ;
334
334
if ( diff > 0 ) {
335
- exports . moveCursor ( this . output , 0 , - diff ) ;
335
+ moveCursor ( this . output , 0 , - diff ) ;
336
336
}
337
337
338
338
this . prevRows = cursorPos . rows ;
@@ -716,7 +716,7 @@ Interface.prototype._moveCursor = function(dx) {
716
716
this . line . substring ( this . cursor , oldcursor )
717
717
) ;
718
718
}
719
- exports . moveCursor ( this . output , diffWidth , 0 ) ;
719
+ moveCursor ( this . output , diffWidth , 0 ) ;
720
720
this . prevRows = newPos . rows ;
721
721
} else {
722
722
this . _refreshLine ( ) ;
@@ -798,8 +798,8 @@ Interface.prototype._ttyWrite = function(s, key) {
798
798
break ;
799
799
800
800
case 'l' : // clear the whole screen
801
- exports . cursorTo ( this . output , 0 , 0 ) ;
802
- exports . clearScreenDown ( this . output ) ;
801
+ cursorTo ( this . output , 0 , 0 ) ;
802
+ clearScreenDown ( this . output ) ;
803
803
this . _refreshLine ( ) ;
804
804
break ;
805
805
@@ -957,10 +957,6 @@ Interface.prototype._ttyWrite = function(s, key) {
957
957
}
958
958
} ;
959
959
960
-
961
- exports . Interface = Interface ;
962
-
963
-
964
960
/**
965
961
* accepts a readable Stream instance and makes it emit "keypress" events
966
962
*/
@@ -1036,8 +1032,6 @@ function emitKeypressEvents(stream, iface) {
1036
1032
stream . on ( 'newListener' , onNewListener ) ;
1037
1033
}
1038
1034
}
1039
- exports . emitKeypressEvents = emitKeypressEvents ;
1040
-
1041
1035
1042
1036
/**
1043
1037
* moves the cursor to the x and y coordinate on the given stream
@@ -1059,8 +1053,6 @@ function cursorTo(stream, x, y) {
1059
1053
stream . write ( '\x1b[' + ( y + 1 ) + ';' + ( x + 1 ) + 'H' ) ;
1060
1054
}
1061
1055
}
1062
- exports . cursorTo = cursorTo ;
1063
-
1064
1056
1065
1057
/**
1066
1058
* moves the cursor relative to its current location
@@ -1082,8 +1074,6 @@ function moveCursor(stream, dx, dy) {
1082
1074
stream . write ( '\x1b[' + dy + 'B' ) ;
1083
1075
}
1084
1076
}
1085
- exports . moveCursor = moveCursor ;
1086
-
1087
1077
1088
1078
/**
1089
1079
* clears the current line the cursor is on:
@@ -1107,8 +1097,6 @@ function clearLine(stream, dir) {
1107
1097
stream . write ( '\x1b[2K' ) ;
1108
1098
}
1109
1099
}
1110
- exports . clearLine = clearLine ;
1111
-
1112
1100
1113
1101
/**
1114
1102
* clears the screen from the current position of the cursor down
@@ -1120,4 +1108,13 @@ function clearScreenDown(stream) {
1120
1108
1121
1109
stream . write ( '\x1b[0J' ) ;
1122
1110
}
1123
- exports . clearScreenDown = clearScreenDown ;
1111
+
1112
+ module . exports = {
1113
+ Interface,
1114
+ clearLine,
1115
+ clearScreenDown,
1116
+ createInterface,
1117
+ cursorTo,
1118
+ emitKeypressEvents,
1119
+ moveCursor
1120
+ } ;
0 commit comments