(
line: number, lo: number, hi: number, room: number,
)
| 6311 | }; |
| 6312 | /** Widest window around `line` inside [lo, hi] that fits `room`. */ |
| 6313 | const centeredWindowOf = ( |
| 6314 | line: number, lo: number, hi: number, room: number, |
| 6315 | ): ExploreLineRange | null => { |
| 6316 | if (line < lo || line > hi) return null; |
| 6317 | let start = line, end = line, chars = lineCost(line); |
| 6318 | for (let grown = true; grown;) { |
| 6319 | grown = false; |
| 6320 | if (end + 1 <= hi && chars + lineCost(end + 1) <= room) { end += 1; chars += lineCost(end); grown = true; } |
| 6321 | if (start - 1 >= lo && chars + lineCost(start - 1) <= room) { start -= 1; chars += lineCost(start); grown = true; } |
| 6322 | } |
| 6323 | return { start, end }; |
| 6324 | }; |
| 6325 | /** |
| 6326 | * Reduce rendered parts to fit `ceiling`, never to nothing. Whole parts are |
| 6327 | * kept while they fit; the first part that overruns is cut to a leading |
nothing calls this directly
no outgoing calls
no test coverage detected