(maxVisibleLines?: number)
| 145 | } |
| 146 | |
| 147 | getViewportStartLine(maxVisibleLines?: number): number { |
| 148 | if (maxVisibleLines === undefined || maxVisibleLines <= 0) return 0 |
| 149 | const { line } = this.getPosition() |
| 150 | const allLines = this.measuredText.getWrappedText() |
| 151 | if (allLines.length <= maxVisibleLines) return 0 |
| 152 | const half = Math.floor(maxVisibleLines / 2) |
| 153 | let startLine = Math.max(0, line - half) |
| 154 | const endLine = Math.min(allLines.length, startLine + maxVisibleLines) |
| 155 | if (endLine - startLine < maxVisibleLines) { |
| 156 | startLine = Math.max(0, endLine - maxVisibleLines) |
| 157 | } |
| 158 | return startLine |
| 159 | } |
| 160 | |
| 161 | getViewportCharOffset(maxVisibleLines?: number): number { |
| 162 | const startLine = this.getViewportStartLine(maxVisibleLines) |
no test coverage detected