emit onScroll event when user is scrolling

This commit is contained in:
Jakob Schrettenbrunner
2021-01-12 22:35:47 +00:00
parent 8b2b0f6abc
commit 82a9ee62d7
2 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -448,7 +448,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
this._instantiationService.setService(IMouseService, this._mouseService);
this.viewport = this._instantiationService.createInstance(Viewport,
(amount: number, suppressEvent: boolean) => this.scrollLines(amount, suppressEvent, ScrollSource.VIEWPORT),
(amount: number) => this.scrollLines(amount, false, ScrollSource.VIEWPORT),
this._viewportElement,
this._viewportScrollArea
);
@@ -480,8 +480,10 @@ export class Terminal extends CoreTerminal implements ITerminal {
this.textarea!.focus();
this.textarea!.select();
}));
this.register(this.onScroll(() => {
this.register(this._onScroll.event(ev => {
if (ev.source !== ScrollSource.VIEWPORT) {
this.viewport!.syncScrollArea();
}
this._selectionService!.refresh();
}));
this.register(addDisposableDomListener(this._viewportElement, 'scroll', () => this._selectionService!.refresh()));
+2 -2
View File
@@ -33,7 +33,7 @@ export class Viewport extends Disposable implements IViewport {
private _ignoreNextScrollEvent: boolean = false;
constructor(
private readonly _scrollLines: (amount: number, suppressEvent: boolean) => void,
private readonly _scrollLines: (amount: number) => void,
private readonly _viewportElement: HTMLElement,
private readonly _scrollArea: HTMLElement,
@IBufferService private readonly _bufferService: IBufferService,
@@ -156,7 +156,7 @@ export class Viewport extends Disposable implements IViewport {
const newRow = Math.round(this._lastScrollTop / this._currentRowHeight);
const diff = newRow - this._bufferService.buffer.ydisp;
this._scrollLines(diff, true);
this._scrollLines(diff);
}
/**