@@ -15,17 +15,11 @@ function Scroller(consoleElement) {
15
15
this . console = consoleElement ;
16
16
this . expandDistance = 200 ;
17
17
18
- //pre-bind functions and throttle expansion
18
+ //pre-bind functions
19
19
this . refresh = this . _renderVisible . bind ( this ) ;
20
20
this . scroll = this . _onScroll . bind ( this ) ;
21
- this . expandTop = _ . throttle ( this . _expandTop . bind ( this ) , 150 , {
22
- leading : true ,
23
- trailing : true
24
- } ) ;
25
- this . expandBottom = _ . throttle ( this . _expandBottom . bind ( this ) , 150 , {
26
- leading : true ,
27
- trailing : true
28
- } ) ;
21
+ this . expandTop = this . _expandTop . bind ( this ) ;
22
+ this . expandBottom = this . _expandBottom . bind ( this ) ;
29
23
}
30
24
31
25
Scroller . prototype . _generateContent = function ( ) {
@@ -48,8 +42,8 @@ Scroller.prototype.setLines = function(newLines, offset) {
48
42
if ( this . sticky ) {
49
43
this . endPosition = this . lineCount ( ) ;
50
44
this . startPosition = Math . max ( this . lineOffset , this . endPosition - this . visibleCount ) ;
51
- if ( this . endPosition <= this . visibleCount ) {
52
- // follow text during initial 50 lines
45
+ if ( this . endPosition <= this . visibleCount * 2 ) {
46
+ // follow text during initial lines (console can show up to twice the visibleCount when expanding)
53
47
this . jumpToBottom = true ;
54
48
}
55
49
} else if ( newLines . length === 1 && newLines [ 0 ] . length === 0 ) {
@@ -89,7 +83,6 @@ Scroller.prototype.requestRefresh = function(){
89
83
Scroller . prototype . _renderVisible = function ( ) {
90
84
this . animateRequest = null ;
91
85
if ( this . dirty && this . console ) {
92
- const top = this . console . scrollTop ;
93
86
if ( this . sticky ) {
94
87
this . endPosition = this . lineCount ( ) ;
95
88
this . startPosition = Math . max ( this . lineOffset , this . endPosition - this . visibleCount ) ;
@@ -98,9 +91,6 @@ Scroller.prototype._renderVisible = function(){
98
91
if ( this . jumpToBottom ) {
99
92
this . console . scrollTop = 4000 ;
100
93
this . jumpToBottom = false ;
101
- } else if ( ! this . sticky && this . startPosition > this . lineOffset && top === this . lineOffset ) {
102
- //cover the situation where the window was fully scrolled faster than expand could keep up and locked to the top
103
- requestAnimationFrame ( this . expandTop ) ;
104
94
}
105
95
this . dirty = false ;
106
96
}
0 commit comments