From fefdd8a4e9cbb8f8f2216b32b0a5558aafa3f05b Mon Sep 17 00:00:00 2001 From: meganrogge Date: Mon, 21 Mar 2022 15:44:17 -0400 Subject: [PATCH] clearDecorations --- addons/xterm-addon-search/src/SearchAddon.ts | 10 +++++----- .../xterm-addon-search/typings/xterm-addon-search.d.ts | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index 2f3fbb6e..bc27e4e4 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -82,11 +82,11 @@ export class SearchAddon implements ITerminalAddon { } public dispose(): void { - this.clear(); + this.clearDecorations(); this._onDataDisposable?.dispose(); } - public clear(): void { + public clearDecorations(): void { this._selectedDecoration?.dispose(); this._terminal?.clearSelection(); this._searchResults.clear(); @@ -116,7 +116,7 @@ export class SearchAddon implements ITerminalAddon { throw new Error('cannot find all matches with no terminal'); } if (!term || term.length === 0) { - this.clear(); + this.clearDecorations(); return false; } searchOptions = searchOptions || {}; @@ -160,7 +160,7 @@ export class SearchAddon implements ITerminalAddon { if (!this._terminal || !term || term.length === 0) { this._result = undefined; this._terminal?.clearSelection(); - this.clear(); + this.clearDecorations(); return false; } @@ -244,7 +244,7 @@ export class SearchAddon implements ITerminalAddon { if (!this._terminal || !term || term.length === 0) { this._result = undefined; this._terminal?.clearSelection(); - this.clear(); + this.clearDecorations(); return false; } diff --git a/addons/xterm-addon-search/typings/xterm-addon-search.d.ts b/addons/xterm-addon-search/typings/xterm-addon-search.d.ts index ef2948a5..e58afec0 100644 --- a/addons/xterm-addon-search/typings/xterm-addon-search.d.ts +++ b/addons/xterm-addon-search/typings/xterm-addon-search.d.ts @@ -64,5 +64,10 @@ declare module 'xterm-addon-search' { * @param searchOptions The options for the search. */ public findPrevious(term: string, searchOptions?: ISearchOptions): boolean; + + /** + * Clears the decorations and selection + */ + public clearDecorations(): void; } }