(
r: ExploreLineRange, room: number, minLines = 0,
)
| 6219 | * else has been emitted and the alternative is an empty section. |
| 6220 | */ |
| 6221 | const headWindowOf = ( |
| 6222 | r: ExploreLineRange, room: number, minLines = 0, |
| 6223 | ): ExploreLineRange | null => { |
| 6224 | let end = r.start - 1; |
| 6225 | let chars = 0; |
| 6226 | for (let ln = r.start; ln <= r.end; ln++) { |
| 6227 | const cost = lineCost(ln); |
| 6228 | if (chars + cost > room && end - r.start + 1 >= minLines) break; |
| 6229 | chars += cost; |
| 6230 | end = ln; |
| 6231 | } |
| 6232 | return end >= r.start ? { start: r.start, end } : null; |
| 6233 | }; |
| 6234 | /** Widest window around `line` inside [lo, hi] that fits `room`. */ |
| 6235 | const centeredWindowOf = ( |
| 6236 | line: number, lo: number, hi: number, room: number, |
nothing calls this directly
no outgoing calls
no test coverage detected