diff --git a/src/config/block.go b/src/config/block.go index 1031f4a2..f4fcdcec 100644 --- a/src/config/block.go +++ b/src/config/block.go @@ -79,7 +79,6 @@ func (b *Block) executeSegmentLogic() { } b.setEnabledSegments() - b.setSegmentsText() } func (b *Block) setEnabledSegments() { @@ -94,15 +93,3 @@ func (b *Block) setEnabledSegments() { }(segment) } } - -func (b *Block) setSegmentsText() { - wg := sync.WaitGroup{} - wg.Add(len(b.Segments)) - defer wg.Wait() - for _, segment := range b.Segments { - go func(s *Segment) { - defer wg.Done() - s.setText() - }(segment) - } -} diff --git a/src/config/segment.go b/src/config/segment.go index b4f501e9..371cd930 100644 --- a/src/config/segment.go +++ b/src/config/segment.go @@ -59,9 +59,8 @@ type Segment struct { Newline bool `json:"newline,omitempty" toml:"newline,omitempty"` CacheDuration cache.Duration `json:"cache_duration,omitempty" toml:"cache_duration,omitempty"` - Enabled bool `json:"-" toml:"-"` - - Text string `json:"-" toml:"-"` + Enabled bool `json:"-" toml:"-"` + Text string `json:"-" toml:"-"` env runtime.Environment writer SegmentWriter @@ -205,8 +204,8 @@ func (segment *Segment) writerCacheKey() string { return fmt.Sprintf("segment_cache_writer_%s_%s", segment.Name(), segment.env.Pwd()) } -func (segment *Segment) setText() { - if !segment.Enabled || len(segment.Text) != 0 { +func (segment *Segment) SetText() { + if !segment.Enabled { return } diff --git a/src/prompt/engine.go b/src/prompt/engine.go index 0a2ae2b9..d26818eb 100644 --- a/src/prompt/engine.go +++ b/src/prompt/engine.go @@ -323,6 +323,8 @@ func (e *Engine) filterSegments(block *config.Block) { segments := make([]*config.Segment, 0) for _, segment := range block.Segments { + segment.SetText() + if !segment.Enabled && segment.ResolveStyle() != config.Accordion { continue }