(maxVisibleLines?: number)
| 170 | } |
| 171 | |
| 172 | getViewportStartLine(maxVisibleLines?: number): number { |
| 173 | if (maxVisibleLines === undefined || maxVisibleLines <= 0) return 0 |
| 174 | const { line } = this.getPosition() |
| 175 | const allLines = this.measuredText.getWrappedText() |
| 176 | if (allLines.length <= maxVisibleLines) return 0 |
| 177 | const half = Math.floor(maxVisibleLines / 2) |
| 178 | let startLine = Math.max(0, line - half) |
| 179 | const endLine = Math.min(allLines.length, startLine + maxVisibleLines) |
| 180 | if (endLine - startLine < maxVisibleLines) { |
| 181 | startLine = Math.max(0, endLine - maxVisibleLines) |
| 182 | } |
| 183 | return startLine |
| 184 | } |
| 185 | |
| 186 | getViewportCharOffset(maxVisibleLines?: number): number { |
| 187 | const startLine = this.getViewportStartLine(maxVisibleLines) |
no test coverage detected