File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ export class Viewport extends Disposable implements IViewport {
3030 private _wheelPartialScroll : number = 0 ;
3131
3232 private _refreshAnimationFrame : number | null = null ;
33+ private _ignoreNextScrollEvent : boolean = false ;
3334
3435 constructor (
3536 private readonly _scrollLines : ( amount : number ) => void ,
@@ -87,12 +88,14 @@ export class Viewport extends Disposable implements IViewport {
8788 // Sync scrollTop
8889 const scrollTop = this . _bufferService . buffer . ydisp * this . _currentRowHeight ;
8990 if ( this . _viewportElement . scrollTop !== scrollTop ) {
91+ // Ignore the next scroll event which will be triggered by setting the scrollTop as we do not
92+ // want this event to scroll the terminal
93+ this . _ignoreNextScrollEvent = true ;
9094 this . _viewportElement . scrollTop = scrollTop ;
9195 }
9296
9397 this . _refreshAnimationFrame = null ;
9498 }
95-
9699 /**
97100 * Updates dimensions and synchronizes the scroll area if necessary.
98101 */
@@ -145,6 +148,12 @@ export class Viewport extends Disposable implements IViewport {
145148 return ;
146149 }
147150
151+ // Ignore the event if it was flagged to ignore (when the source of the event is from Viewport)
152+ if ( this . _ignoreNextScrollEvent ) {
153+ this . _ignoreNextScrollEvent = false ;
154+ return ;
155+ }
156+
148157 const newRow = Math . round ( this . _lastScrollTop / this . _currentRowHeight ) ;
149158 const diff = newRow - this . _bufferService . buffer . ydisp ;
150159 this . _scrollLines ( diff ) ;
You can’t perform that action at this time.
0 commit comments