@@ -188,9 +188,9 @@ export class InlineChatZoneWidget extends ZoneWidget {
188
188
return isResponseVM ( candidate ) && candidate . response . value . length > 0 ;
189
189
} ) ;
190
190
191
- if ( hasResponse && zoneTop < scrollTop || this . _scrollUp . didScrollUp ) {
191
+ if ( hasResponse && zoneTop < scrollTop || this . _scrollUp . didScrollUpOrDown ) {
192
192
// don't reveal the zone if it is already out of view (unless we are still getting ready)
193
- // or if an outside scroll-up happened (e.g the user scrolled up to see the new content)
193
+ // or if an outside scroll-up happened (e.g the user scrolled up/down to see the new content)
194
194
return this . _scrollUp . runIgnored ( ( ) => {
195
195
scrollState . restore ( this . editor ) ;
196
196
} ) ;
@@ -244,8 +244,7 @@ export class InlineChatZoneWidget extends ZoneWidget {
244
244
245
245
class ScrollUpState {
246
246
247
- private _lastScrollTop : number = this . _editor . getScrollTop ( ) ;
248
- private _didScrollUp ?: boolean ;
247
+ private _didScrollUpOrDown ?: boolean ;
249
248
private _ignoreEvents = false ;
250
249
251
250
private readonly _listener = new MutableDisposable ( ) ;
@@ -257,23 +256,19 @@ class ScrollUpState {
257
256
}
258
257
259
258
enable ( ) : void {
260
- this . _didScrollUp = undefined ;
259
+ this . _didScrollUpOrDown = undefined ;
261
260
this . _listener . value = this . _editor . onDidScrollChange ( e => {
262
261
if ( ! e . scrollTopChanged || this . _ignoreEvents ) {
263
262
return ;
264
263
}
265
- const currentScrollTop = e . scrollTop ;
266
- if ( currentScrollTop > this . _lastScrollTop ) {
267
- this . _listener . clear ( ) ;
268
- this . _didScrollUp = true ;
269
- }
270
- this . _lastScrollTop = currentScrollTop ;
264
+ this . _listener . clear ( ) ;
265
+ this . _didScrollUpOrDown = true ;
271
266
} ) ;
272
267
}
273
268
274
269
disable ( ) : void {
275
270
this . _listener . clear ( ) ;
276
- this . _didScrollUp = undefined ;
271
+ this . _didScrollUpOrDown = undefined ;
277
272
}
278
273
279
274
runIgnored ( callback : ( ) => void ) : ( ) => void {
@@ -287,8 +282,8 @@ class ScrollUpState {
287
282
} ;
288
283
}
289
284
290
- get didScrollUp ( ) : boolean | undefined {
291
- return this . _didScrollUp ;
285
+ get didScrollUpOrDown ( ) : boolean | undefined {
286
+ return this . _didScrollUpOrDown ;
292
287
}
293
288
294
289
}
0 commit comments