import { Actions } from "../state/interfaces"; /** * A #command binding: the pager action, an optional canonical key for * key-sensitive actions (`-`/`_`), and the "extra" input string fed * after the action, like lesskey's A_EXTRA. */ interface UserBinding { action: Actions | undefined; key?: string; extra?: string; } export declare const LESS_VERSION = 707; /** * One lesskey a session loaded, in whatever shape it arrived. * * The loader takes up to six at once and merges them, so "the current * lesskey" is a list, not a file. --edit-lesskey needs to know which * ones were real to put them all in front of the user. */ export interface LesskeyForm { /** How it was stored: editable text, compiled bytes, or a variable. */ kind: 'source' | 'binary' | 'content'; /** The file path, or the variable name for a content form. */ origin: string; /** System-wide rather than the user's own. */ system: boolean; } /** The lesskey forms this session loaded, in ladder order. */ export declare const lesskeyForms: () => LesskeyForm[]; /** * Notes a lesskey that loaded. The ladder records its own; the option * scan records what the command line added, since that arrives after * loadLesskey has already run (less's init_cmds precedes scan_option). */ export declare function recordLesskeyForm(form: LesskeyForm): void; /** The #command binding for a key sequence, if the user made one. */ export declare const userBinding: (seq: string) => UserBinding | undefined; /** * The sequence a user bound to an action, for the two that are read as * the INTRODUCER of a longer report rather than matched whole: less's * A_X11MOUSE_IN and A_X116MOUSE_IN, which lesskey names "mouse" and * "mouse6" (lesskey_parse.c:72). Everything after the introducer is * the report's own bytes, so the dispatcher has to know the prefix. */ export declare function userBoundTo(action: Actions): string | undefined; /** True when #stop discards the built-in key bindings. */ export declare const userStop: () => boolean; /** * Resolves a #line-edit binding to the built-in editing key it stands * for, leaving unbound keys alone. */ export declare const translateEditKey: (key: string) => string; /** Forgets all lesskey state for a fresh session. */ export declare function resetLesskey(): void; export declare function loadLesskey(quiet?: boolean): void; /** * Parses a compiled lesskey file, like decode.c's new_lesskey and * old_lesskey: the new format wraps c/e/v sections between the * "\0M+G" and "End" magics; the old format is one raw command table. * Invalid files are ignored silently, like less returning -1. */ export declare function parseLesskeyBinary(buf: Buffer, system?: boolean): void; /** * Finds the lesskey source file, like add_hometable's lookup. */ export declare function lesskeyFile(): string | null; /** * Parses a lesskey source, like lesskey_parse.c's parse_lesskey: * #command, #line-edit and #env switch sections, #stop discards the * built-in bindings, #version guards a line, and other #-lines are * comments. * * @param text - The lesskey source. * @param filename - Name reported in parse errors. */ export declare function parseLesskey(text: string, filename: string, system?: boolean): number; /** * Parses inline lesskey source, like less's parse_lesskey_content * (lesskey_parse.c:738): lines end at a newline OR a semicolon, a * backslash escapes a literal semicolon, and a line hitting the * 1023-char cap SPLITS - the remainder becomes the next line. * * @param text - The --lesskey-content / $LESSKEY_CONTENT value. */ export declare function parseLesskeyContent(text: string, system?: boolean): number; /** * True when more characters could complete a longer binding, like * cmd_search answering A_PREFIX. */ export declare function userIsPrefix(seq: string): boolean; export {};