docs(addon-search): align README and public typings
Clarify decorations usage, result event semantics, whole-word boundaries, and export ISearchDecorationOptions. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,9 +22,11 @@ searchAddon.findNext('foo');
|
|||||||
|
|
||||||
### Search options
|
### Search options
|
||||||
|
|
||||||
- `decorations`: Highlight all matches and fire `onDidChangeResults` with result counts.
|
- `decorations` (`ISearchDecorationOptions`): Enables match highlighting and result tracking; pass a decoration options object (colors may be omitted).
|
||||||
- `highlightLimit` (constructor option): Caps how many matches are tracked/highlighted (default `1000`).
|
- `highlightLimit` (constructor option): Caps how many matches are tracked/highlighted (default `1000`).
|
||||||
- `incremental`: Expands the current selection when the term still matches.
|
- `incremental`: Expands the current selection when the term still matches.
|
||||||
- `wholeWord`, `regex`, `caseSensitive`: Control match semantics.
|
- `wholeWord`, `regex`, `caseSensitive`: Control match semantics.
|
||||||
|
|
||||||
|
`onDidChangeResults` fires after `findNext`/`findPrevious` when `decorations` is set. `clearDecorations()` clears highlights and tracked results but does not emit this event.
|
||||||
|
|
||||||
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-search/typings/addon-search.d.ts) for more advanced usage.
|
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-search/typings/addon-search.d.ts) for more advanced usage.
|
||||||
|
|||||||
+5
-3
@@ -17,7 +17,8 @@ declare module '@xterm/addon-search' {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to search for a whole word, the result is only valid if it's
|
* Whether to search for a whole word, the result is only valid if it's
|
||||||
* surrounded in "non-word" characters such as `_`, `(`, `)` or space.
|
* surrounded by start/end of line or non-word separators such as whitespace
|
||||||
|
* and punctuation (for example `(`, `)`, or space).
|
||||||
*/
|
*/
|
||||||
wholeWord?: boolean;
|
wholeWord?: boolean;
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ declare module '@xterm/addon-search' {
|
|||||||
/**
|
/**
|
||||||
* Options for showing decorations when searching.
|
* Options for showing decorations when searching.
|
||||||
*/
|
*/
|
||||||
interface ISearchDecorationOptions {
|
export interface ISearchDecorationOptions {
|
||||||
/**
|
/**
|
||||||
* The background color of a match, this must use #RRGGBB format.
|
* The background color of a match, this must use #RRGGBB format.
|
||||||
*/
|
*/
|
||||||
@@ -162,7 +163,8 @@ declare module '@xterm/addon-search' {
|
|||||||
readonly onBeforeSearch: IEvent<void>;
|
readonly onBeforeSearch: IEvent<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When decorations are enabled, fires when the search results change.
|
* When decorations are enabled, fires after `findNext`/`findPrevious` when tracked
|
||||||
|
* search results change. Does not fire from `clearDecorations()`.
|
||||||
*/
|
*/
|
||||||
readonly onDidChangeResults: IEvent<ISearchResultChangeEvent>;
|
readonly onDidChangeResults: IEvent<ISearchResultChangeEvent>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user