Hook up scroll APIs to scroll and focus when navigating

This commit is contained in:
Daniel Imms
2018-01-27 18:14:52 -08:00
parent 0bdf1e8265
commit b13826441c
2 changed files with 85 additions and 9 deletions
+17 -3
View File
@@ -1187,26 +1187,40 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
this.refresh(0, this.rows - 1);
}
/**
* Scrolls the viewport by a number of rows when not navigating rows. When
* navigating rows, move focus relatively by a number of rows.
* @param amount The number of lines to scroll.
*/
private _accessibilityAwareScrollLines(amount: number): void {
console.log('_accessibilityAwareScrollLines');
if (this.options.screenReaderMode && this._accessibilityManager.isNavigatingRows) {
this._accessibilityManager.moveRowFocus(amount);
} else {
this.scrollLines(amount);
}
}
/**
* Scroll the display of the terminal by a number of pages.
* @param {number} pageCount The number of pages to scroll (negative scrolls up).
*/
public scrollPages(pageCount: number): void {
this.scrollLines(pageCount * (this.rows - 1));
this._accessibilityAwareScrollLines(pageCount * (this.rows - 1));
}
/**
* Scrolls the display of the terminal to the top.
*/
public scrollToTop(): void {
this.scrollLines(-this.buffer.ydisp);
this._accessibilityAwareScrollLines(-this.buffer.ydisp);
}
/**
* Scrolls the display of the terminal to the bottom.
*/
public scrollToBottom(): void {
this.scrollLines(this.buffer.ybase - this.buffer.ydisp);
this._accessibilityAwareScrollLines(this.buffer.ybase - this.buffer.ydisp);
}
/**