mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
add disposeDecorations helper
This commit is contained in:
@@ -90,12 +90,16 @@ export class SearchAddon implements ITerminalAddon {
|
||||
this._selectedDecoration?.dispose();
|
||||
this._terminal?.clearSelection();
|
||||
this._searchResults.clear();
|
||||
this._resultDecorations.forEach(decorations => decorations.forEach(d=> d.dispose()));
|
||||
this._resultDecorations.clear();
|
||||
this._disposeDecorations();
|
||||
this._cachedSearchTerm = undefined;
|
||||
this._dataChanged = true;
|
||||
}
|
||||
|
||||
private _disposeDecorations(): void {
|
||||
this._resultDecorations.forEach(decorations => decorations.forEach(d=> d.dispose()));
|
||||
this._resultDecorations.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the next instance of the term, then scroll to and select it. If it
|
||||
* doesn't exist, do nothing.
|
||||
@@ -124,8 +128,7 @@ export class SearchAddon implements ITerminalAddon {
|
||||
return selectionType === SelectionType.NEXT ? this._findAndSelectNext(term, searchOptions) : this._findAndSelectPrevious(term, searchOptions);
|
||||
}
|
||||
// new search, clear out the old decorations
|
||||
this._resultDecorations.forEach(decorations => decorations.forEach(d=> d.dispose()));
|
||||
this._resultDecorations.clear();
|
||||
this._disposeDecorations();
|
||||
this._searchResults.clear();
|
||||
|
||||
if (!this._terminal.options.overviewRulerWidth) {
|
||||
|
||||
Reference in New Issue
Block a user