code/editor/find/useFind
import { … } from 'zidane-ui/code/editor'ui/src/code/editor/find/useFind.ts
Functions#
useFindFunction#
Find state for a file view or a column of diffs: counts every match in the model, highlights
the rendered ones and scrolls the current match into view. Pass the result to FindBar.
function useFind(
args: UseFindArgs,
): { asked: number; capped: boolean; caseSensitive: boolean; close: () => void; index: number; jumpTo: (q: string, o: FindOptions, at: Omit<LineMatch, 'end'>) => void; open: boolean; query: string; searching: boolean; setQuery: Dispatch<SetStateAction<string>>; show: () => void; step: (direction: -1 | 1) => void; toggleCase: () => void; total: number }Parameters
| Name | Type | Description |
|---|---|---|
| args | UseFindArgs | See |
Returns
{ asked: number; capped: boolean; caseSensitive: boolean; close: () => void; index: number; jumpTo: (q: string, o: FindOptions, at: Omit<LineMatch, 'end'>) => void; open: boolean; query: string; searching: boolean; setQuery: Dispatch<SetStateAction<string>>; show: () => void; step: (direction: -1 | 1) => void; toggleCase: () => void; total: number }Interfaces#
FindPartsInterface#
One diff (or the file) to search: its lines and the part key its matches carry.
interface FindPartsProperties
| Name | Type | Description |
|---|---|---|
| lines | readonly FindLine[] | The searchable lines ( |
| part | string | Ties matches to the rendered surface with the same |
UseFindArgsInterface#
What useFind searches, paints and scrolls.
interface UseFindArgsProperties
| Name | Type | Description |
|---|---|---|
| fallback | (match: LineMatch, scroller: HTMLElement) => ScrollTarget | Where a match's part is when its line is not rendered: an element, or an estimate. |
| parts | () => readonly FindParts[] | The searchable model; only built while find is open. |
| scroller | () => HTMLElement | null | The scroll box holding the surfaces. |
| smooth | boolean | Ease the scroll to the current match over several frames; |
| surfaces | () => readonly FindSurface[] | Rendered surfaces, read at paint time. |
| version | unknown | Bumps when |