Skip to content

Commit

Permalink
fix(prompt): render segments when everything is executed
Browse files Browse the repository at this point in the history
resolves #5816
  • Loading branch information
JanDeDobbeleer committed Nov 5, 2024
1 parent 52c39b8 commit da6c925
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/prompt/segments.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,20 @@ func (e *Engine) writeSegments(out chan result, block *config.Block) {
count := len(block.Segments)
// store the current index
current := 0
// keep track of what we already executed
executedCount := 0
// store the results
results := make([]*config.Segment, count)
// store the names of executed segments
// store the unique names of executed segments
executed := make([]string, count)

for {
select {
case res := <-out:
executedCount++

finished := executedCount == count

results[res.index] = res.segment

name := res.segment.Name()
Expand All @@ -63,7 +69,7 @@ func (e *Engine) writeSegments(out chan result, block *config.Block) {
segment := results[current]

for segment != nil {
if !e.canRenderSegment(segment, executed) {
if !e.canRenderSegment(segment, executed) && !finished {
break
}

Expand Down

0 comments on commit da6c925

Please sign in to comment.