mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-25 19:14:50 -08:00
revert(segment): add to cache after rendering
This commit is contained in:
parent
7f97c36adb
commit
f838eaf00a
|
@ -115,11 +115,14 @@ func (segment *Segment) Execute(env runtime.Environment) {
|
|||
return
|
||||
}
|
||||
|
||||
if shouldHideForWidth(env, segment.MinWidth, segment.MaxWidth) {
|
||||
if shouldHideForWidth(segment.env, segment.MinWidth, segment.MaxWidth) {
|
||||
return
|
||||
}
|
||||
|
||||
segment.Enabled = segment.writer.Enabled()
|
||||
if segment.writer.Enabled() {
|
||||
segment.Enabled = true
|
||||
env.TemplateCache().AddSegmentData(segment.Name(), segment.writer)
|
||||
}
|
||||
}
|
||||
|
||||
func (segment *Segment) Render() {
|
||||
|
@ -135,8 +138,7 @@ func (segment *Segment) Render() {
|
|||
return
|
||||
}
|
||||
|
||||
segment.SetText(text)
|
||||
segment.env.TemplateCache().AddSegmentData(segment.Name(), segment.writer)
|
||||
segment.writer.SetText(text)
|
||||
segment.setCache()
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,11 @@ func (e *Engine) writeSegments(out chan result, block *config.Block) {
|
|||
|
||||
results[res.index] = res.segment
|
||||
|
||||
name := res.segment.Name()
|
||||
if !slices.Contains(executed, name) {
|
||||
executed = append(executed, name)
|
||||
}
|
||||
|
||||
segment := results[current]
|
||||
|
||||
for segment != nil {
|
||||
|
@ -75,11 +80,6 @@ func (e *Engine) writeSegments(out chan result, block *config.Block) {
|
|||
|
||||
current++
|
||||
segment = results[current]
|
||||
|
||||
name := res.segment.Name()
|
||||
if !slices.Contains(executed, name) {
|
||||
executed = append(executed, name)
|
||||
}
|
||||
}
|
||||
default:
|
||||
runtime.Gosched()
|
||||
|
|
Loading…
Reference in a new issue