Support ILink.dispose
When displaying hovers/overlays using the link provider API currently it's not possible to know when unused links are no longer cached in xterm.js which can result in leaked event listeners.
This commit is contained in:
@@ -125,6 +125,13 @@ export class Linkifier2 extends Disposable implements ILinkifier2 {
|
||||
|
||||
private _askForLink(position: IBufferCellPosition, useLineCache: boolean): void {
|
||||
if (!this._activeProviderReplies || !useLineCache) {
|
||||
this._activeProviderReplies?.forEach(reply => {
|
||||
reply?.forEach(linkWithState => {
|
||||
if (linkWithState.link.dispose) {
|
||||
linkWithState.link.dispose();
|
||||
}
|
||||
});
|
||||
});
|
||||
this._activeProviderReplies = new Map();
|
||||
this._activeLine = position.y;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -275,6 +275,7 @@ interface ILink {
|
||||
activate(event: MouseEvent, text: string): void;
|
||||
hover?(event: MouseEvent, text: string): void;
|
||||
leave?(event: MouseEvent, text: string): void;
|
||||
dispose?(): void;
|
||||
}
|
||||
|
||||
interface ILinkDecorations {
|
||||
|
||||
Reference in New Issue
Block a user