(
line: number, lo: number, hi: number, room: number,
)
| 6289 | }; |
| 6290 | /** Widest window around `line` inside [lo, hi] that fits `room`. */ |
| 6291 | const centeredWindowOf = ( |
| 6292 | line: number, lo: number, hi: number, room: number, |
| 6293 | ): ExploreLineRange | null => { |
| 6294 | if (line < lo || line > hi) return null; |
| 6295 | let start = line, end = line, chars = lineCost(line); |
| 6296 | for (let grown = true; grown;) { |
| 6297 | grown = false; |
| 6298 | if (end + 1 <= hi && chars + lineCost(end + 1) <= room) { end += 1; chars += lineCost(end); grown = true; } |
| 6299 | if (start - 1 >= lo && chars + lineCost(start - 1) <= room) { start -= 1; chars += lineCost(start); grown = true; } |
| 6300 | } |
| 6301 | return { start, end }; |
| 6302 | }; |
| 6303 | /** |
| 6304 | * Reduce rendered parts to fit `ceiling`, never to nothing. Whole parts are |
| 6305 | * 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