import { Readable } from 'stream'; import { Config, Mode } from './interfaces'; /** * The pager session state, like less's globals spread across its C * files: one live session at a time, reset by resetSession() when a * pager entry starts. Module scope (rather than contentPager's * closure) keeps every field initialized before any key can arrive * and lets feature modules share the state without threading it. */ export declare const session: { /** The displayed lines; the help screen swaps them out. */ content: string[]; /** The raw input lines; pipes and streamed files append here. */ fullContent: string[]; /** The main content parked while the help screen displays. */ prevContent: string[]; /** The main config parked while the help screen displays. */ prevConfig: Config; /** The main mode flags parked while the help screen displays. */ prevMode: Record; /** The SOURCE lines of the help page on screen: an O_REPAINT option * toggled inside it re-transforms the page being looked at, and * there is more than one (the commands help, --lesskey-help). */ helpSource: string[]; /** The key sequence being dispatched. */ key: string; /** Pending ESC count while a sequence collects. */ escCount: number; /** The digit-prefix buffer, like less's cmdbuf number. */ buffer: string[]; /** Queued + commands for the first prompt (less's ungotten input). */ pendingFirstCmds: string[]; /** The errmsgs gate's ungot key, ordinary input after the +cmds. */ ungotStartKey: string; /** Waiting after !/| with the terminal handed to the shell. */ shellPause: false | "shell" | "pager"; /** True once the session ended; exit() resolves the main loop. */ exited: boolean; exit: () => void; /** True when the help screen IS the input (--help/-?), like less's * dohelp FAKE_HELPFILE: q then quits instead of restoring. */ startupHelp: boolean; /** Inside bracketed paste markers, text accepted (--no-paste). */ pasting: boolean; /** Dropping pasted input until the end marker or the timeout. */ ignoringPaste: boolean; ignoreStart: number; /** The F command's polling timer. */ followTimer: ReturnType | null; /** A LESSOPEN edit warning waiting for RETURN before v runs. */ pendingEditWarn: boolean; /** Collected keys of a partially matched lesskey user binding. */ userSeq: string; /** The last --emouse click row, and hdrag/vdrag origins, like * less's last_drag_x/y. */ lastClickY: number; lastDragX: number; lastDragY: number; /** The active & display filter over fullContent. */ lastFilter: ((line: string) => boolean) | null; /** True when a & filter is hiding lines BELOW the bottom line. * less's eof_displayed asks where the bottom line ends in the FILE * (forwback.c:76), which is not the same question as mode.EOF - * "is anything left to display". They differ only here. */ filterHidesTail: boolean; /** less's soft_eof, as a flag: a forward read has RETURNED EOF since * the filter was set (forwback.c:310), or a jump to the end walked * back through it (jump.c:62). Either makes the bottom line count * as the end even with a filtered tail behind it. Cleared when a * new filter is set, like command.c:282. */ softEofSeen: boolean; /** The process title to restore at exit. */ processTitle: string; pipeStream: Readable | null; pipePaused: boolean; pipeDrainTo: (() => void) | null; detachPipe: () => void; /** Bytes of pipe data kept before the oldest recycle away: -B * limits it to the -b buffer space up front (ch.c's maxbufs for * pipes); otherwise the budget locks in at the first sign of * heap pressure, less's failed-allocation moment. */ pipeBudget: number; /** less paints arriving lines only while the initial forw() fills * the first screenful; afterwards an idle pager never repaints * on new pipe data (F is the follow command). */ pipeFirstFill: boolean; /** Keys typed during the initial fill wait like less's check_poll * queuing tty chars (ungetcc_back) until the read completes. */ fillKeys: string[]; /** The "Waiting for data..." state, less's waiting_for_data. */ pipeWaiting: boolean; /** less's pending S_INTERRUPT: the next gate's ungot key clears. */ intrPending: boolean; /** Feeds deferred keys back through the session's key handler. */ feedKeys: (data: string) => void; /** -F reads the pipe before any terminal init, like less's * get_one_screen: nothing reaches the screen while it decides. */ pipeProbing: boolean; }; /** * Starts a fresh session over the given content, like a new less * process resetting its globals. */ export declare function resetSession(content: string[]): void; /** * Derives the display lines from the raw input: the & filter * applies first, then the -s/-x/-r transform pipeline. */ export declare function deriveContent(): string[]; /** * $LESS_SHELL_LINES reserves shell rows in one-screen tests, like * less get_one_screen's `nlines + shell_lines <= sc_height`. */ export declare function shellReserveLines(): number;