Skip to content

Commit

Permalink
Fix search not destroying cache on linefeed
Browse files Browse the repository at this point in the history
Fixes #4994
  • Loading branch information
Tyriar committed Mar 16, 2024
1 parent b7b9d27 commit 3e5d001
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions addons/addon-search/src/SearchAddon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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());
}
Expand All @@ -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;
Expand Down

0 comments on commit 3e5d001

Please sign in to comment.