/** * Option value types, like opttbl.c: BOOL toggles, TRIPLE has lower and * upper states, NUMBER and STRING prompt for a parameter, NOVAR runs an * action. */ /** Content-rebuild hook, set by the pager (onRebuild), the -b * buffer trim hook (onTrimBufSpace), and whether the pager screen * is initialized: less writes mouse/paste modes only from screen * init and TOGGLE handlers, never during the option scan. */ export declare const hook: { rebuildContent: () => void; /** less's O_HL_REPAINT: re-highlight NOW, under the option's message. */ hiliteRepaint: () => void; /** Rebuilds the compiled pattern, for when the ENGINE changed under * it (--use-js-regexp) rather than the pattern or its case. */ recompilePattern: () => void; hiliteErase: () => void; /** Reads the top row's character offset, returning a function that * restores it once the width has changed (less's table[TOP]). */ topOffset: (content: string[]) => () => void; /** Moves a source engine's own top back to its line start, for * less's pos_rehead. */ reheadSource: null | (() => void); /** less's opt_k: load a COMPILED lesskey file named by -k, returning * false when lesskey() would have returned nonzero (unreadable, * shorter than 3 bytes, or blocked by SECURE/LESSNOCONFIG). Set by * features/lesskey to keep the option table free of that import. */ loadLesskeyFile: (path: string) => boolean; trimBufSpace: () => void; screenActive: boolean; /** --file-size draining a still-unknown pipe (less's opt_filesize). */ scanFileSize: () => void; /** Opens the lesskey syntax page, like the h command opens help. */ showLesskeyHelp: () => void; /** Puts a message on the bottom row NOW, before slow work runs. */ flashMessage: (text: string) => void; viewLesskey: () => void; /** Absolute 1-based line number for a source-backed local row. */ sourceLineNumber: null | ((row: number) => number | null | undefined); /** Absolute byte position for a source-backed local row. */ sourceBytePosition: null | ((row: number) => number | null | undefined); /** Total raw line count for a seekable source. */ sourceLineCount: null | (() => number | null | undefined); /** Local materialized row holding the absolute header start. */ sourceHeaderRow: null | (() => number | undefined); /** Moves a seekable source when --header changes its absolute start. */ sourceHeaderChanged: null | ((start: number) => void); /** less's screen_trashed for an O_REPAINT option: the next * make_display repaints through jump_loc, which rebuilds the screen * from the position table rather than from whatever the last * command left standing. */ sourceRepaint: null | (() => void); /** Raw bytes between two absolute file positions, like less's * pipe_data reading ch.c between spos and epos. The pipe needs the * FILE, not the materialized window: session.content holds only the * rows currently spooled. */ sourceReadRange: null | ((from: number, to: number) => Buffer | null); /** less's curr_byte(where): the byte at a SCREEN ROW, read off the * position table. A wrapped line puts several rows in one line, so * this is not the line's byte - which is what makes %bB and %pB * land mid-line on a long line. */ sourceRowByte: null | ((sindex: number) => number | null); }; /** Registers the immediate -b pool trim, like less's ch_setbufspace. */ export declare function onTrimBufSpace(fn: () => void): void; /** Per prompt style --end-prompt strings (short, medium, long). */ export declare const endPrompts: (string | null)[]; /** Default search modifiers set by --search-options. */ declare const defSearchType: { pastEof: boolean; fromStart: boolean; keep: boolean; invert: boolean; noRegex: boolean; wrap: boolean; subs: Set; }; export declare const EMOUSE_HSCROLL = 1; export declare const EMOUSE_VSCROLL = 2; export declare const EMOUSE_HDRAG = 4; export declare const EMOUSE_VDRAG = 8; export declare const EMOUSE_LCLICK = 16; export declare const EMOUSE_RCLICK = 32; /** Fresh-search start mode of -a/-A (less's how_search). */ export declare const optHowSearch: () => number; /** Match highlighting mode of -g/-G (less's hilite_search). */ export declare const optHiliteSearch: () => number; /** State 2 of -e/-E etc, read by the pager loop; $LESS_IS_MORE maps * the flag onto more's -e semantics, like less's get_quit_at_eof. */ export declare const optQuitAtEof: () => number; /** Bell suppression level of -q/-Q. */ export declare const optQuiet: () => number; /** True when -c forces full repaints instead of scrolling. */ export declare const optClearRepaint: () => boolean; /** Backward scroll limit of -h, -1 when unlimited. */ export declare const optBackScroll: () => number; /** Forward scroll limit of -y, -1 when unlimited. */ export declare const optForwScroll: () => number; /** True when -K makes ctrl-C exit the pager. */ export declare const optQuitOnIntr: () => boolean; /** True when -F quits a file that fits on the first screen. */ export declare const optQuitIfOneScreen: () => boolean; /** The prompt style used for display: more mode defaults to medium * and -m selects short, like less's pr_string type mapping. */ export declare const displayPrType: () => number; /** Line number mode of -n/-N (0 off, 1 on, 2 displayed). */ export declare const optLinenums: () => number; /** Control char display of -r/-R (0 caret, 1 raw, 2 ANSI through). */ export declare const optCtldisp: () => number; /** True when -s squeezes runs of blank lines. */ export declare const optSqueeze: () => boolean; /** Unread-line highlight mode of -w/-W (less's show_attn). */ export declare const optShowAttn: () => number; /** True when -J displays the status column. */ export declare const optStatusCol: () => boolean; /** The -" shell quote characters. */ export declare const optQuotes: () => { open: string; close: string; }; /** True when tildes pad past end of file (-~ default on). */ export declare const optTildes: () => boolean; /** True when --no-histdups removes duplicate history entries. */ export declare const optNoHistDups: () => boolean; /** Mouse mode of --mouse (0 off, 1 on, 2 reverse). */ export declare const optMouse: () => number; /** True when --rmouse (or --MOUSE) reverses the scroll direction. */ export declare const optMouseReverse: () => boolean; /** True when --save-marks persists marks in the history file. */ export declare const optPermaMarks: () => boolean; /** The -N line number field width (--line-num-width). */ export declare const optLinenumWidth: () => number; /** The -J column width (--status-col-width). */ export declare const optStatusColWidth: () => number; /** True when --incsearch searches as the pattern is typed. */ export declare const optIncrSearch: () => boolean; /** The --header state: pinned lines, columns and 0-based start row. */ export declare const optHeader: () => { lines: number; cols: number; start: number; }; /** * Re-anchors the header at the top of a newly opened file, like less's * edit_ifile calling set_header(ch_zero()). */ export declare function resetHeaderStart(): void; /** The --no-search-header-* state: exclude header lines/columns. */ export declare const optNoSearchHeaders: () => { lines: boolean; cols: boolean; }; /** True when --redraw-on-quit repaints the last screen at exit. */ export declare const optRedrawOnQuit: () => boolean; /** True when --no-paste ignores bracketed paste input. */ export declare const optNoPaste: () => boolean; /** True when --hilite-target highlights search/jump targets. */ export declare const optHiliteTarget: () => boolean; /** True when --autosave includes an action char (or `*`). */ export declare const optAutosaveAction: (act: string) => boolean; /** The --search-options default modifiers for a fresh search. */ export declare const optDefSearchType: () => typeof defSearchType; /** * The --match-shift columns for the current screen width, like less's * calc_match_shift resolving a fraction (parts per million, rounded * like less's muldiv; the default fraction is half the width). */ export declare function optMatchShift(): number; /** True when --emouse enables left-click mark setting. */ export declare const optEmouseLclick: () => boolean; /** True when --emouse enables right-click mark jumping. */ export declare const optEmouseRclick: () => boolean; /** True when --emouse (or --mouse) enables vertical wheel scrolling. */ export declare const optWheelEnabled: () => boolean; /** True when --status-line highlights whole marked/attn lines. */ export declare const optStatusLine: () => boolean; /** True when --form-feed stops scrolling at a \f line. */ export declare const optStopOnFormFeed: () => boolean; /** True when --past-eof lets forward scrolls continue past (END). */ export declare const optPastEof: () => boolean; /** The -u/-U backspace mode (0 special, 1 plain, 2 control). */ export declare const optBsMode: () => number; /** The --proc-backspace state (0 default, 1 overstrike, 2 ^H). */ export declare const optProcBackspace: () => number; /** The --proc-tab state (0 default, 1 expand, 2 ^I). */ export declare const optProcTab: () => number; /** The --proc-return state (0 default, 1 delete at EOL, 2 ^M). */ export declare const optProcReturn: () => number; /** True when --wordwrap breaks wrapped lines at spaces. */ export declare const optWordwrap: () => boolean; /** True when -X suppresses the terminal init/deinit strings. */ export declare const optNoInit: () => boolean; /** True when --no-keypad suppresses keypad mode. */ export declare const optNoKeypad: () => boolean; /** True when --no-vbell suppresses the visual bell flash. */ export declare const optNoVbell: () => boolean; /** True when --use-color enables the -D color map. */ export declare const optUseColor: () => boolean; /** True when --use-js-regexp searches with the host RegExp instead of * the POSIX engine less's regcomp would give. */ export declare const optUseJsRegexp: () => boolean; /** The -T tags file name (or a GTAGS-family name). */ export declare const optTagsFile: () => string; /** Resets -T to the "tags" default, for -T- once stdin is read. */ export declare const resetTagsFile: () => void; /** True when -d suppresses the dumb terminal warning. */ export declare const optKnowDumb: () => boolean; /** The --intr character that leaves the F wait (default ^X). */ export declare const optIntrChar: () => string; /** True while $LESSOPEN preprocessing is enabled (-L turns it off). */ export declare const optUseLessopen: () => boolean; /** True when --show-preproc-errors reports preprocessor failures. */ export declare const optShowPreprocError: () => boolean; /** True when --no-edit-warn skips the LESSOPEN editing warning. */ export declare const optNoEditWarn: () => boolean; /** True when interactive shell, pipe and editor commands are disabled. */ export declare const optNoShell: () => boolean; /** less's deliberately terse error for an unavailable process escape. */ export declare const NO_SHELL_MESSAGE = "Command not available"; /** True when --follow-name makes F re-open the file by name. */ export declare const optFollowName: () => boolean; /** True when --exit-follow-on-close ends F when the input closes. */ export declare const optExitFollowOnClose: () => boolean; /** The --end-prompt string for the current prompt style, if any. */ export declare const optEndPrompt: () => string | null; /** True when --old-bot clears the bottom line from lower-left, like * less's clear_bot choosing lower_left over line_left. */ export declare const optOldBot: () => boolean; /** * Scans the first --modelines lines for vim-style modelines, like * edit.c's check_modelines: only ts=/tabstop= settings are honored. */ export declare function checkModelines(lines: string[]): void; /** * Adjusts a 1-based display line number for --no-number-headers, like * linenum.c's vlinenum: the header lines and everything above them get * no number (0), lines below the header restart at 1. */ export declare function vlinenum(linenum: number): number; /** Applies --no-number-headers to an already absolute line number. */ export declare function vlinenumAbsolute(absolute: number): number; export { fullScreenWidth } from "./state"; /** The -j target as a 0-based screen row for the current window. */ export declare function jumpSindex(): number; /** The -# shift columns, resolving a fraction of the screen width * like less's calc_shift_count; 0 means the half-screen default. */ export declare function optShiftCount(): number; /** * Stores a numeric shift from an ESC-(/ESC-) count, clearing the -# * fraction like less's A_LSHIFT with a number. */ export declare function setShiftCount(count: number): void; /** * Parses a number or a `.F` fraction, like optfunc.c's toggle_fraction * with getfraction: the fraction keeps six digits (parts per million). * * @returns The parsed value, or null after the less error message. */ export declare function parseFraction(text: string, printopt: string, negok: boolean): { num: number; frac: number; } | null; /** * Formats a value-or-fraction query, like optfunc.c's query_fraction * trimming trailing zeros down to two characters. */ export declare function queryFraction(value: number, frac: number, intMsg: string, fracMsg: string): string; /** Lines per mouse wheel tick (--wheel-lines). */ export declare const optWheelLines: () => number; /** Truncation marker character (--rscroll), empty when disabled. */ export declare const optRscroll: () => string; /** The --rscroll fallback attribute codes when -D R sets no color, * like less's rscroll_attr from setfmt's `*x` prefix. */ export declare function optRscrollAttr(): { on: string; off: string; }; /** * True when displayed lines are truncated at the screen width: -S, or * any --header lines/columns, like less's chop_line(). */ export declare const chopLine: () => boolean; /** * The scroll window size, like less's get_swindow: a positive -z is the * size itself; zero or negative is relative to the screen height less * the --header lines (the default -1 leaves one line of overlap). */ export declare function getSwindow(): number; /** * Returns the next tab stop after a column, like less's tabstops list: * explicit stops first, then every tabDefault columns. */ export declare function nextTabStop(col: number): number; /** * Columns reserved at the left edge for the -J status column and the * -N line number field: less's NOMINAL width (line_pfx_width returns * linenum_width + 1, line.c:459) — a wider number overflows the * field and its LINE's text area shrinks instead (the line buffer * simply fills to sc_width past the actual prefix). */ export declare function gutterWidth(): number; /** * Reserves the gutter inside a freshly measured screen width; call * right after config.screenWidth is set from the terminal size. */ export declare function reserveGutter(): void; /** * Re-applies the gutter after a display option changed its width. */ export declare function applyGutter(content: string[]): void; /** Registers the content pipeline rebuild used by -s, -x and -r. */ export declare function onRebuild(fn: () => void): void; /** * Writes the mouse tracking codes for the current --mouse/--emouse * state. */ export declare function applyMouse(): void; /** * Turns terminal bracketed paste markers on with --no-paste, so pasted * input can be recognized and ignored. */ export declare function applyBracketedPaste(): void; /** Displays a control char like less's prchar (^X, ESC, ^?). */ export declare function prChar(char: string): string; /** * Parses a comma-separated --emouse feature list, like decode.c's * parse_csl_bitmap: names prefix-match and combinations expand. * * Invalid/ambiguous members contribute no bits but do not stop the * list, matching csl_bitmap_bit returning zero to parse_csl_bitmap. */ export declare function parseEmouse(text: string): number; /** * Builds the --emouse query list, like opt_emouse's QUERY greedily * naming combinations before their components. */ export declare function emouseNames(): string; /** * Parses a --search-options answer, like opt_search_type: EFKNRW set * default modifiers, digits pick sub-patterns, `-` clears. */ export declare function setSearchType(text: string): void; /** Formats the --search-options state, like opt_search_type QUERY. */ export declare function searchTypeNames(): string; /** * Parses a --match-shift answer, like toggle_fraction with the `.d` * format: a leading `.` sets a fraction of the screen width, kept in * parts per million like less. */ export declare function setMatchShift(text: string): void; export declare const CASELESS_MESSAGES: string[]; /** * Sets the header search exclusions, like optfunc.c's * do_nosearch_headers: the three options assign both flags rather than * toggling. Silent, so $LESS INIT matches less; toggles report through * noSearchHeadersMessage. */ export declare function setNoSearchHeaders(lines: number, cols: number): void; export declare function noSearchHeadersMessage(): void; /** * Recomputes the EOF anchor after a display-affecting toggle (-S). */ export declare function recalculateEOF(content: string[]): void; /** * Parses the -x tab stop list, like less's set_tabs: a comma-separated * ascending list whose last interval repeats. Non-increasing entries * are skipped without ending the list, and fewer than two resulting * stops (counting the fixed leading 0) leave the old stops unchanged. */ export declare function setTabs(text: string): void; /** * Reports a startup scan problem at the first prompt, like less's * error() calls before the screen initializes: follow-ups queue behind * the first message. */ export declare function optScanError(message: string): void; /** Applies a command-line --header once content exists; the first * display's jump clamps through after_header_pos, so the screen * opens at the header start. */ export declare function applyPendingHeader(content: string[]): void; export declare function setHeader(text: string, content: string[]): void;