Add basic support for cursor blinking

This commit is contained in:
Daniel Imms
2017-09-01 11:34:52 -07:00
parent 848c85c1eb
commit 882d7e4a30
5 changed files with 121 additions and 9 deletions
+21 -1
View File
@@ -1,5 +1,5 @@
import { IRenderLayer } from './Interfaces';
import { ITerminal } from '../Interfaces';
import { ITerminal, ITerminalOptions } from '../Interfaces';
import { COLORS } from './Color';
export abstract class BaseRenderLayer implements IRenderLayer {
@@ -27,6 +27,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
}
}
public onOptionsChanged(options: ITerminal): void {
// TODO: Should this do anything?
}
public resize(terminal: ITerminal, canvasWidth: number, canvasHeight: number, charSizeChanged: boolean): void {
this.scaledCharWidth = terminal.charMeasure.width * window.devicePixelRatio;
this.scaledCharHeight = terminal.charMeasure.height * window.devicePixelRatio;
@@ -56,6 +60,22 @@ export abstract class BaseRenderLayer implements IRenderLayer {
this._ctx.fillRect(startCol * this.scaledCharWidth, startRow * this.scaledCharHeight, colWidth * this.scaledCharWidth, colHeight * this.scaledCharHeight);
}
protected fillBottomLineAtCell(x: number, y: number): void {
this._ctx.fillRect(
x * this.scaledCharWidth,
(y + 1) * this.scaledCharHeight - window.devicePixelRatio - 1 /* Ensure it's drawn within the cell */,
this.scaledCharWidth,
window.devicePixelRatio);
}
protected fillLeftLineAtCell(x: number, y: number): void {
this._ctx.fillRect(
x * this.scaledCharWidth,
y * this.scaledCharHeight,
window.devicePixelRatio,
this.scaledCharHeight);
}
protected clearAll(): void {
this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
}