(
r: ExploreLineRange, room: number, minLines = 0,
)
| 6275 | * else has been emitted and the alternative is an empty section. |
| 6276 | */ |
| 6277 | const headWindowOf = ( |
| 6278 | r: ExploreLineRange, room: number, minLines = 0, |
| 6279 | ): ExploreLineRange | null => { |
| 6280 | let end = r.start - 1; |
| 6281 | let chars = 0; |
| 6282 | for (let ln = r.start; ln <= r.end; ln++) { |
| 6283 | const cost = lineCost(ln); |
| 6284 | if (chars + cost > room && end - r.start + 1 >= minLines) break; |
| 6285 | chars += cost; |
| 6286 | end = ln; |
| 6287 | } |
| 6288 | return end >= r.start ? { start: r.start, end } : null; |
| 6289 | }; |
| 6290 | /** Widest window around `line` inside [lo, hi] that fits `room`. */ |
| 6291 | const centeredWindowOf = ( |
| 6292 | line: number, lo: number, hi: number, room: number, |
nothing calls this directly
no outgoing calls
no test coverage detected