less-pager-mini
Version:
A scrollable terminal pager for Node.js CLI apps (terminal only)
101 lines (100 loc) • 4.09 kB
TypeScript
/**
* Moves forward by a given offset through content lines or subrows.
*
* @param content - Full content lines.
* @param offset - Number of lines/subrows to move forward.
* @param ignoreEOF - If true, ignores EOF clamp (optional).
*/
export declare function lineForward(content: string[], offset: number, ignoreEOF?: boolean): void;
/**
* Scroll backward by the given offset.
*
* - Stops and rings bell at BOF, also disables `mode.INIT`.
* - In chopped mode, moves by whole lines.
* - In wrapped mode, moves by sub-rows within a line.
*
* @param content - Full content lines.
* @param offset - Lines or sub-rows to scroll backward.
*/
export declare function lineBackward(content: string[], offset: number): void;
/**
* Scrolls the view forward by a window size.
*
* - If `buffer` is a valid number, it overrides the default window size.
* - Falls back to `config.setWindow` or `config.window - 1` if `buffer` is
* invalid.
* - If `ignoreEOF` is `true`, allows scrolling beyond (END) without clamping.
*
* @param content - The full content to paginate.
* @param buffer - A string array that represents the number of lines to scroll.
* @param ignoreEOF - Whether to bypass EOF constraints during scrolling.
*/
export declare function windowForward(content: string[], buffer: string[], ignoreEOF?: boolean): void;
/**
* Moves the view backward by one window.
*
* - If `buffer` is a valid number, uses it as the offset.
* - Otherwise, uses `config.setWindow` if set, or defaults to
* `config.window - 1`.
*
* @param content - The full content as an array of lines.
* @param buffer - A string array that represents the number of lines to scroll.
*/
export declare function windowBackward(content: string[], buffer: string[]): void;
/**
* Sets a custom window size using the given `buffer`, and scrolls forward.
*
* - If `buffer` is a valid number, updates `config.setWindow` with it.
* - Then scrolls forward by `config.setWindow` or falls back to
* `config.window - 1`.
*
* @param content - The full content as an array of lines.
* @param buffer - A string array that represents the number of lines to scroll.
*/
export declare function setWindowForward(content: string[], buffer: string[]): void;
/**
* Sets a custom window size using the given `buffer`, and scrolls backward.
*
* - If `buffer` is a valid number, updates `config.setWindow` with it.
* - Then scrolls backward by `config.setWindow` or falls back to
* `config.window - 1`.
*
* @param content - The full content as an array of lines.
* @param buffer - A string array that represents the number of lines to scroll.
*/
export declare function setWindowBackward(content: string[], buffer: string[]): void;
/**
* Sets a custom half-window size using the given `buffer`, and scrolls forward.
*
* - If `buffer` is a valid number, updates `config.setHalfWindow` with it.
* - Then scrolls forward by `config.setHalfWindow` or falls back to
* `config.halfWindow`.
*
* @param content - The full content as an array of lines.
* @param buffer - A string array that represents the number of lines to scroll.
*/
export declare function setHalfWindowForward(content: string[], buffer: string[]): void;
/**
* Sets a custom half-window size using the given `buffer`, and scrolls
* backward.
*
* - If `buffer` is a valid number, updates `config.setHalfWindow` with it.
* - Then scrolls backward by `config.setHalfWindow` or falls back to
* `config.halfWindow`.
*
* @param content - The full content as an array of lines.
* @param buffer - A string array that represents the number of lines to scroll.
*/
export declare function setHalfWindowBackward(content: string[], buffer: string[]): void;
/**
* Scrolls right by buffer value or half screen width.
*
* @param buffer - Buffer containing scroll offset.
*/
export declare function setHalfScreenRight(buffer: string[]): void;
/**
* Scrolls left by buffer value or half screen width.
*
* @param buffer - Buffer containing scroll offset.
*/
export declare function setHalfScreenLeft(buffer: string[]): void;