Merge branch 'xtermjs:master' into master
This commit is contained in:
@@ -546,7 +546,6 @@ function loadTest() {
|
|||||||
function addDecoration() {
|
function addDecoration() {
|
||||||
const marker = term.addMarker(1);
|
const marker = term.addMarker(1);
|
||||||
const decoration = term.registerDecoration({ marker });
|
const decoration = term.registerDecoration({ marker });
|
||||||
term.write('');
|
|
||||||
decoration.onRender(() => {
|
decoration.onRender(() => {
|
||||||
decoration.element.style.backgroundColor = 'red';
|
decoration.element.style.backgroundColor = 'red';
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export class DecorationService extends Disposable implements IDecorationService
|
|||||||
private _container: HTMLElement | undefined;
|
private _container: HTMLElement | undefined;
|
||||||
private _screenElement: HTMLElement | undefined;
|
private _screenElement: HTMLElement | undefined;
|
||||||
private _renderService: IRenderService | undefined;
|
private _renderService: IRenderService | undefined;
|
||||||
|
private _animationFrame: number | undefined;
|
||||||
|
|
||||||
constructor(@IInstantiationService private readonly _instantiationService: IInstantiationService) { super(); }
|
constructor(@IInstantiationService private readonly _instantiationService: IInstantiationService) { super(); }
|
||||||
|
|
||||||
@@ -35,9 +36,20 @@ export class DecorationService extends Disposable implements IDecorationService
|
|||||||
const decoration = this._instantiationService.createInstance(Decoration, decorationOptions, this._container);
|
const decoration = this._instantiationService.createInstance(Decoration, decorationOptions, this._container);
|
||||||
this._decorations.push(decoration);
|
this._decorations.push(decoration);
|
||||||
decoration.onDispose(() => this._decorations.splice(this._decorations.indexOf(decoration), 1));
|
decoration.onDispose(() => this._decorations.splice(this._decorations.indexOf(decoration), 1));
|
||||||
|
this._queueRefresh();
|
||||||
return decoration;
|
return decoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _queueRefresh(): void {
|
||||||
|
if (this._animationFrame !== undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._animationFrame = window.requestAnimationFrame(() => {
|
||||||
|
this.refresh();
|
||||||
|
this._animationFrame = undefined;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public refresh(shouldRecreate?: boolean): void {
|
public refresh(shouldRecreate?: boolean): void {
|
||||||
if (!this._renderService) {
|
if (!this._renderService) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user