/** * Opens a run: a search, or one frame's highlighting. * * Declared rather than guessed. A gap between calls would have to * stand in for "the user got their screen back", and the difference * between a frame's twelfth line and the next frame's first is * microseconds either way. */ export declare function beginGuardedRun(): void; /** Closes a run, so the watcher stops taking keys nobody asked it to. */ export declare function endGuardedRun(): void; /** * The watcher's verdict, for the scan between matches. * * Reading this is a shared word rather than a read(2) on the tty: one * thread watches the terminal for the whole run, and everything else * asks it. The keys it took come back through takeGuardedKeys. */ export declare function watcherSawInterrupt(): boolean; /** True while a watcher is doing the reading for this run. */ export declare const watcherActive: () => boolean; /** Whatever the watcher took off the terminal and has not handed back. */ export declare function takeGuardedKeys(): string; /** $LMN_GUARD_TRACE names a file to log what the guard did, and when. */ export declare function trace(what: string): void; /** * Tells the guard how to watch the terminal, and what to say when a * match has been out too long. * * The styling belongs to the caller - this is the same message the * line-number walk writes, and it should not be spelled twice - but * the writing has to happen on a thread that is awake, so the bytes * are handed over rather than a callback. */ export declare function watchWith(fd: number | null, intr: string, notice: string, clearRow: string): void; /** Drops the workers, for a session that is closing down. */ export declare function endJsRegexGuard(): void; /** The last worker error, empty when there has not been one. */ export declare const jsRegexFailure: () => string; /** Whether the last guarded call was interrupted rather than answered. */ export declare const jsRegexAborted: () => boolean; /** Whether the last guarded call announced itself before finishing. */ export declare const jsRegexNoticed: () => boolean; /** * Whether an interrupt stopped it, rather than some other key. * * The watcher makes that call, and it is the only one who can: the * poll on this side never runs while a watcher is attached, so the * flag it would have set stays as it was. An abort that read as "some * other key" is why ^C stopped raising the offer to try POSIX. */ export declare const jsRegexAbortedByInterrupt: () => boolean; /** Clears both, at the start of a new search. */ export declare function clearJsRegexAbort(): void; /** * Runs one match in the matcher, waiting until it or the watcher says * otherwise. * * @param request - Pattern, flags, subject, and which call to make. * @param anyKey - True when any keypress should end the wait, not * only an interrupt: a repaint runs behind whatever the user does * next, a search is what they are waiting for. * @param fallbackPoll - Used only when there is no terminal to watch, * in slices, because a wait with nothing to wake it never returns. * @returns The worker's answer, and any keys the watcher took. */ export declare function guardedMatch(request: { source: string; flags: string; text: string; test: boolean; }, anyKey: boolean, fallbackPoll?: () => boolean, messageUp?: boolean): { answer: { test?: boolean; match?: { index: number; groups: string[]; } | null; } | null; keys: string; };