Skip to content

@jsvision/ui / replacePrompt

Function: replacePrompt()

replacePrompt(host, cursor): Promise<"cancel" | "yes" | "no">

Defined in: ui/src/editor/dialogs.ts:184

Show the "replace this occurrence?" prompt (Yes / No / Cancel) used during an interactive replace. The box sits near the top of the desktop, but drops to the bottom when the caret is high enough that the box would otherwise cover it.

Parameters

host

ModalDialogHost

The modal host ({ loop: app.loop, desktop: app.desktop }).

cursor

Point

The caret position in absolute (desktop) coordinates, used to avoid covering it.

Returns

Promise<"cancel" | "yes" | "no">

The button the user chose.

Example

ts
// Inside an editorDialog handler for a 'replacePrompt' request:
const answer = await replacePrompt({ loop: app.loop, desktop: app.desktop }, req.cursor);