Fix search not destroying cache on linefeed

Fixes #4994
This commit is contained in:
Daniel Imms
2024-03-16 09:30:25 -07:00
parent b7b9d27627
commit 3e5d0015af
+6
View File
@@ -78,6 +78,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon , ISearchA
*/
private _linesCache: LineCacheEntry[] | undefined;
private _linesCacheTimeoutId = 0;
private _lineFeedListener: IDisposable | undefined;
private _cursorMoveListener: IDisposable | undefined;
private _resizeListener: IDisposable | undefined;
@@ -427,6 +428,7 @@ export class SearchAddon extends Disposable implements ITerminalAddon , ISearchA
const terminal = this._terminal!;
if (!this._linesCache) {
this._linesCache = new Array(terminal.buffer.active.length);
this._lineFeedListener = terminal.onLineFeed(() => this._destroyLinesCache());
this._cursorMoveListener = terminal.onCursorMove(() => this._destroyLinesCache());
this._resizeListener = terminal.onResize(() => this._destroyLinesCache());
}
@@ -445,6 +447,10 @@ export class SearchAddon extends Disposable implements ITerminalAddon , ISearchA
this._resizeListener.dispose();
this._resizeListener = undefined;
}
if (this._lineFeedListener) {
this._lineFeedListener.dispose();
this._lineFeedListener = undefined;
}
if (this._linesCacheTimeoutId) {
window.clearTimeout(this._linesCacheTimeoutId);
this._linesCacheTimeoutId = 0;