mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
fix the problem
This commit is contained in:
@@ -578,7 +578,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
||||
this.linkifier.attachToDom(this.element, this._mouseZoneManager);
|
||||
this.linkifier2.attachToDom(this.screenElement, this._mouseService, this._renderService);
|
||||
|
||||
this.decorationService.attachToDom(this.screenElement);
|
||||
this.decorationService.attachToDom(this.screenElement, this._renderService, this._bufferService);
|
||||
// This event listener must be registered aftre MouseZoneManager is created
|
||||
this.register(addDisposableDomListener(this.element, 'mousedown', (e: MouseEvent) => this._selectionService!.onMouseDown(e)));
|
||||
|
||||
|
||||
@@ -14,17 +14,20 @@ export class DecorationService extends Disposable implements IDecorationService
|
||||
private readonly _decorations: Decoration[] = [];
|
||||
private _screenElement: HTMLElement | undefined;
|
||||
|
||||
private _renderService: IRenderService | undefined;
|
||||
private _bufferService: IBufferService | undefined;
|
||||
|
||||
constructor(
|
||||
@IBufferService private readonly _bufferService: IBufferService,
|
||||
@IRenderService private readonly _renderService: IRenderService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService
|
||||
) {
|
||||
super();
|
||||
this.register(this._renderService.onRenderedBufferChange(() => this.refresh()));
|
||||
}
|
||||
|
||||
public attachToDom(screenElement: HTMLElement): void {
|
||||
public attachToDom(screenElement: HTMLElement, renderService: IRenderService, bufferService: IBufferService): void {
|
||||
this._screenElement = screenElement;
|
||||
this._renderService = renderService;
|
||||
this._bufferService = bufferService;
|
||||
this.register(this._renderService.onRenderedBufferChange(() => this.refresh()));
|
||||
}
|
||||
|
||||
public registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined {
|
||||
@@ -38,6 +41,9 @@ export class DecorationService extends Disposable implements IDecorationService
|
||||
}
|
||||
|
||||
public refresh(): void {
|
||||
if (!this._bufferService || !this._renderService) {
|
||||
return;
|
||||
}
|
||||
for (const decoration of this._decorations) {
|
||||
if (!decoration.element) {
|
||||
continue;
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ISelectionRedrawRequestEvent as ISelectionRequestRedrawEvent, ISelectio
|
||||
import { createDecorator } from 'common/services/ServiceRegistry';
|
||||
import { IDisposable } from 'common/Types';
|
||||
import { IDecorationOptions, IDecoration } from 'xterm';
|
||||
import { IBufferService } from 'common/services/Services';
|
||||
|
||||
export const ICharSizeService = createDecorator<ICharSizeService>('CharSizeService');
|
||||
export interface ICharSizeService {
|
||||
@@ -120,5 +121,5 @@ export const IDecorationService = createDecorator<IDecorationService>('Decoratio
|
||||
export interface IDecorationService extends IDisposable {
|
||||
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
|
||||
refresh(): void;
|
||||
attachToDom(screenElement: HTMLElement): void;
|
||||
attachToDom(screenElement: HTMLElement, renderService: IRenderService, bufferService: IBufferService): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user