mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
fix(prompt): render segments when everything is executed
resolves #5816
This commit is contained in:
parent
52c39b8d30
commit
da6c925945
|
@ -45,14 +45,20 @@ func (e *Engine) writeSegments(out chan result, block *config.Block) {
|
||||||
count := len(block.Segments)
|
count := len(block.Segments)
|
||||||
// store the current index
|
// store the current index
|
||||||
current := 0
|
current := 0
|
||||||
|
// keep track of what we already executed
|
||||||
|
executedCount := 0
|
||||||
// store the results
|
// store the results
|
||||||
results := make([]*config.Segment, count)
|
results := make([]*config.Segment, count)
|
||||||
// store the names of executed segments
|
// store the unique names of executed segments
|
||||||
executed := make([]string, count)
|
executed := make([]string, count)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case res := <-out:
|
case res := <-out:
|
||||||
|
executedCount++
|
||||||
|
|
||||||
|
finished := executedCount == count
|
||||||
|
|
||||||
results[res.index] = res.segment
|
results[res.index] = res.segment
|
||||||
|
|
||||||
name := res.segment.Name()
|
name := res.segment.Name()
|
||||||
|
@ -63,7 +69,7 @@ func (e *Engine) writeSegments(out chan result, block *config.Block) {
|
||||||
segment := results[current]
|
segment := results[current]
|
||||||
|
|
||||||
for segment != nil {
|
for segment != nil {
|
||||||
if !e.canRenderSegment(segment, executed) {
|
if !e.canRenderSegment(segment, executed) && !finished {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue