(room: number)
| 5290 | .sort((a, b) => a - b); |
| 5291 | /** Source-ordered fill of whole parts, the overrunning one cut to a head window. */ |
| 5292 | const fill = (room: number): { emit: ExploreLineRange[]; used: number } => { |
| 5293 | const emit: ExploreLineRange[] = []; |
| 5294 | let used = 0; |
| 5295 | for (const p of parts) { |
| 5296 | const join = emit.length > 0 ? GAP_MARKER.length : 0; |
| 5297 | if (used + join + p.text.length <= room) { |
| 5298 | emit.push(p.range); |
| 5299 | used += join + p.text.length; |
| 5300 | continue; |
| 5301 | } |
| 5302 | const first = emit.length === 0; |
| 5303 | const win = headWindowOf( |
| 5304 | p.range, Math.max(0, room - used - join), first ? MIN_WINDOW_LINES : 0); |
| 5305 | if (win && (first || win.end - win.start + 1 >= MIN_WINDOW_LINES)) { |
| 5306 | emit.push(win); |
| 5307 | used += join + renderSpan(win).length; |
| 5308 | } |
| 5309 | break; |
| 5310 | } |
| 5311 | return { emit, used }; |
| 5312 | }; |
| 5313 | let { emit, used } = fill(ceiling); |
| 5314 | const reached = () => (emit.length ? emit[emit.length - 1]!.end : 0); |
| 5315 | if (focus.some((l) => l > reached())) { |
no outgoing calls