# code/editor/useRevealLine (zidane-ui/code/editor)

Import: `import { … } from 'zidane-ui/code/editor'`. Source: [ui/src/code/editor/useRevealLine.ts](https://github.com/Tahul/zidane/blob/main/ui/src/code/editor/useRevealLine.ts).

## Functions

### `useRevealLine`

Function.

Scrolls a `CodeEditor` to `reveal`, selects its line and, when `caret`, places the caret there; see the module comment.

```ts
function useRevealLine(
  editor: RefObject<CodeEditorHandle | null>,
  reveal: RevealTarget | null | undefined,
  select: (line: number) => void,
  caret: boolean,
): void
```

**Parameters**

- `editor` (`RefObject<CodeEditorHandle | null>`): The editor's handle.
- `reveal` (`RevealTarget | null | undefined`): Where to go, once per nonce.
- `select` (`(line: number) => void`): Selects the line (the owner's selection state).
- `caret` (`boolean`): Whether to place the caret (an editable view).

Source: [ui/src/code/editor/useRevealLine.ts:36](https://github.com/Tahul/zidane/blob/main/ui/src/code/editor/useRevealLine.ts#L36)

## Interfaces

### `RevealTarget`

Interface.

A 1-based position to reveal; a new `nonce` reveals the same one again.

```ts
interface RevealTarget
```

**Properties**

- `column` (`number`): 1-based column where the caret lands.
- `line` (`number`): 1-based line to select and centre.
- `nonce` (`number`): Bump it to reveal the same position again.

Source: [ui/src/code/editor/useRevealLine.ts:16](https://github.com/Tahul/zidane/blob/main/ui/src/code/editor/useRevealLine.ts#L16)
