fix(addon-search): normalize invalid highlightLimit values

Clamp highlightLimit to a positive finite integer, falling back to the
default when the option is missing or invalid.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Daniel Imms
2026-05-25 17:42:22 -07:00
co-authored by Cursor
parent d99803293e
commit 2146e4940d
+2 -1
View File
@@ -54,7 +54,8 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp
constructor(options?: Partial<ISearchAddonOptions>) {
super();
this._highlightLimit = options?.highlightLimit ?? Constants.DEFAULT_HIGHLIGHT_LIMIT;
const limit = options?.highlightLimit ?? Constants.DEFAULT_HIGHLIGHT_LIMIT;
this._highlightLimit = Number.isFinite(limit) && limit > 0 ? Math.floor(limit) : Constants.DEFAULT_HIGHLIGHT_LIMIT;
}
public activate(terminal: Terminal): void {