MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / pageScroll

Method pageScroll

packages/pi-tui/src/components/editor.ts:1923–1933  ·  view source on GitHub ↗

* Scroll by a page (direction: -1 for up, 1 for down). * Moves cursor by the page size while keeping it in bounds.

(direction: -1 | 1)

Source from the content-addressed store, hash-verified

1921 * Moves cursor by the page size while keeping it in bounds.
1922 */
1923 private pageScroll(direction: -1 | 1): void {
1924 this.lastAction = null;
1925 const terminalRows = this.tui.terminal.rows;
1926 const pageSize = Math.max(5, Math.floor(terminalRows * 0.3));
1927
1928 const visualLines = this.buildVisualLineMap(this.lastWidth);
1929 const currentVisualLine = this.findCurrentVisualLine(visualLines);
1930 const targetVisualLine = Math.max(0, Math.min(visualLines.length - 1, currentVisualLine + direction * pageSize));
1931
1932 this.moveToVisualLine(visualLines, currentVisualLine, targetVisualLine);
1933 }
1934
1935 private moveWordBackwards(): void {
1936 this.lastAction = null;

Callers 1

handleInputMethod · 0.95

Calls 3

buildVisualLineMapMethod · 0.95
findCurrentVisualLineMethod · 0.95
moveToVisualLineMethod · 0.95

Tested by

no test coverage detected