fixes #3517
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
This commit is contained in:
co-authored by
Daniel Imms
parent
a11ba0a89c
commit
d2bcbc73d3
@@ -60,7 +60,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
|
|
||||||
this._renderLayers = [
|
this._renderLayers = [
|
||||||
new LinkRenderLayer(this._core.screenElement!, 2, this._colors, this._core),
|
new LinkRenderLayer(this._core.screenElement!, 2, this._colors, this._core),
|
||||||
new CursorRenderLayer(this._core.screenElement!, 3, this._colors, this._onRequestRedraw)
|
new CursorRenderLayer(_terminal, this._core.screenElement!, 3, this._colors, this._onRequestRedraw)
|
||||||
];
|
];
|
||||||
this.dimensions = {
|
this.dimensions = {
|
||||||
scaledCharWidth: 0,
|
scaledCharWidth: 0,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
private _cell: ICellData = new CellData();
|
private _cell: ICellData = new CellData();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
terminal: Terminal,
|
||||||
container: HTMLElement,
|
container: HTMLElement,
|
||||||
zIndex: number,
|
zIndex: number,
|
||||||
colors: IColorSet,
|
colors: IColorSet,
|
||||||
@@ -49,7 +50,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
'block': this._renderBlockCursor.bind(this),
|
'block': this._renderBlockCursor.bind(this),
|
||||||
'underline': this._renderUnderlineCursor.bind(this)
|
'underline': this._renderUnderlineCursor.bind(this)
|
||||||
};
|
};
|
||||||
// TODO: Consider initial options? Maybe onOptionsChanged should be called at the end of open?
|
this.onOptionsChanged(terminal);
|
||||||
}
|
}
|
||||||
|
|
||||||
public resize(terminal: Terminal, dim: IRenderDimensions): void {
|
public resize(terminal: Terminal, dim: IRenderDimensions): void {
|
||||||
@@ -66,25 +67,18 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
|
|
||||||
public reset(terminal: Terminal): void {
|
public reset(terminal: Terminal): void {
|
||||||
this._clearCursor();
|
this._clearCursor();
|
||||||
if (this._cursorBlinkStateManager) {
|
this._cursorBlinkStateManager?.restartBlinkAnimation(terminal);
|
||||||
this._cursorBlinkStateManager.dispose();
|
this.onOptionsChanged(terminal);
|
||||||
this.onOptionsChanged(terminal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public onBlur(terminal: Terminal): void {
|
public onBlur(terminal: Terminal): void {
|
||||||
if (this._cursorBlinkStateManager) {
|
this._cursorBlinkStateManager?.pause();
|
||||||
this._cursorBlinkStateManager.pause();
|
|
||||||
}
|
|
||||||
this._onRequestRefreshRowsEvent.fire({ start: terminal.buffer.active.cursorY, end: terminal.buffer.active.cursorY });
|
this._onRequestRefreshRowsEvent.fire({ start: terminal.buffer.active.cursorY, end: terminal.buffer.active.cursorY });
|
||||||
}
|
}
|
||||||
|
|
||||||
public onFocus(terminal: Terminal): void {
|
public onFocus(terminal: Terminal): void {
|
||||||
if (this._cursorBlinkStateManager) {
|
this._cursorBlinkStateManager?.resume(terminal);
|
||||||
this._cursorBlinkStateManager.resume(terminal);
|
this._onRequestRefreshRowsEvent.fire({ start: terminal.buffer.active.cursorY, end: terminal.buffer.active.cursorY });
|
||||||
} else {
|
|
||||||
this._onRequestRefreshRowsEvent.fire({ start: terminal.buffer.active.cursorY, end: terminal.buffer.active.cursorY });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public onOptionsChanged(terminal: Terminal): void {
|
public onOptionsChanged(terminal: Terminal): void {
|
||||||
@@ -104,9 +98,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onCursorMove(terminal: Terminal): void {
|
public onCursorMove(terminal: Terminal): void {
|
||||||
if (this._cursorBlinkStateManager) {
|
this._cursorBlinkStateManager?.restartBlinkAnimation(terminal);
|
||||||
this._cursorBlinkStateManager.restartBlinkAnimation(terminal);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public onGridChanged(terminal: Terminal, startRow: number, endRow: number): void {
|
public onGridChanged(terminal: Terminal, startRow: number, endRow: number): void {
|
||||||
@@ -296,6 +288,7 @@ class CursorBlinkStateManager {
|
|||||||
// Clear any existing interval
|
// Clear any existing interval
|
||||||
if (this._blinkInterval) {
|
if (this._blinkInterval) {
|
||||||
window.clearInterval(this._blinkInterval);
|
window.clearInterval(this._blinkInterval);
|
||||||
|
this._blinkInterval = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the initial timeout which will hide the cursor, this is done before
|
// Setup the initial timeout which will hide the cursor, this is done before
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
'block': this._renderBlockCursor.bind(this),
|
'block': this._renderBlockCursor.bind(this),
|
||||||
'underline': this._renderUnderlineCursor.bind(this)
|
'underline': this._renderUnderlineCursor.bind(this)
|
||||||
};
|
};
|
||||||
// TODO: Consider initial options? Maybe onOptionsChanged should be called at the end of open?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public resize(dim: IRenderDimensions): void {
|
public resize(dim: IRenderDimensions): void {
|
||||||
@@ -72,26 +71,18 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
|
|
||||||
public reset(): void {
|
public reset(): void {
|
||||||
this._clearCursor();
|
this._clearCursor();
|
||||||
if (this._cursorBlinkStateManager) {
|
this._cursorBlinkStateManager?.restartBlinkAnimation();
|
||||||
this._cursorBlinkStateManager.dispose();
|
this.onOptionsChanged();
|
||||||
this._cursorBlinkStateManager = undefined;
|
|
||||||
this.onOptionsChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public onBlur(): void {
|
public onBlur(): void {
|
||||||
if (this._cursorBlinkStateManager) {
|
this._cursorBlinkStateManager?.pause();
|
||||||
this._cursorBlinkStateManager.pause();
|
|
||||||
}
|
|
||||||
this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });
|
this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });
|
||||||
}
|
}
|
||||||
|
|
||||||
public onFocus(): void {
|
public onFocus(): void {
|
||||||
if (this._cursorBlinkStateManager) {
|
this._cursorBlinkStateManager?.resume();
|
||||||
this._cursorBlinkStateManager.resume();
|
this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });
|
||||||
} else {
|
|
||||||
this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public onOptionsChanged(): void {
|
public onOptionsChanged(): void {
|
||||||
@@ -111,9 +102,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onCursorMove(): void {
|
public onCursorMove(): void {
|
||||||
if (this._cursorBlinkStateManager) {
|
this._cursorBlinkStateManager?.restartBlinkAnimation();
|
||||||
this._cursorBlinkStateManager.restartBlinkAnimation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public onGridChanged(startRow: number, endRow: number): void {
|
public onGridChanged(startRow: number, endRow: number): void {
|
||||||
@@ -300,6 +289,7 @@ class CursorBlinkStateManager {
|
|||||||
// Clear any existing interval
|
// Clear any existing interval
|
||||||
if (this._blinkInterval) {
|
if (this._blinkInterval) {
|
||||||
window.clearInterval(this._blinkInterval);
|
window.clearInterval(this._blinkInterval);
|
||||||
|
this._blinkInterval = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the initial timeout which will hide the cursor, this is done before
|
// Setup the initial timeout which will hide the cursor, this is done before
|
||||||
|
|||||||
Reference in New Issue
Block a user