* 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)
| 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; |
no test coverage detected