fix(segment): do not set cache when restored

resolves #6011
This commit is contained in:
Jan De Dobbeleer 2024-12-14 14:15:58 +01:00 committed by Jan De Dobbeleer
parent c2734a97a5
commit 7768cb2984

View file

@ -72,6 +72,7 @@ type Segment struct {
Enabled bool `json:"-" toml:"-"` Enabled bool `json:"-" toml:"-"`
Newline bool `json:"newline,omitempty" toml:"newline,omitempty"` Newline bool `json:"newline,omitempty" toml:"newline,omitempty"`
InvertPowerline bool `json:"invert_powerline,omitempty" toml:"invert_powerline,omitempty"` InvertPowerline bool `json:"invert_powerline,omitempty" toml:"invert_powerline,omitempty"`
restored bool `json:"-" toml:"-"`
} }
func (segment *Segment) Name() string { func (segment *Segment) Name() string {
@ -238,11 +239,13 @@ func (segment *Segment) restoreCache() bool {
log.Debug("restored segment from cache: ", segment.Name()) log.Debug("restored segment from cache: ", segment.Name())
segment.restored = true
return true return true
} }
func (segment *Segment) setCache() { func (segment *Segment) setCache() {
if !segment.hasCache() { if segment.restored || !segment.hasCache() {
return return
} }