diff --git a/bar.go b/bar.go index 0c9b824..41b2487 100644 --- a/bar.go +++ b/bar.go @@ -58,6 +58,7 @@ type extFunc func(in io.Reader, tw int, st *decor.Statistics) (out io.Reader, lines int) type bState struct { + baseF Filler filler Filler id int width int @@ -165,7 +166,7 @@ SetRefill(int64) } b.operateState <- func(s *bState) { - if f, ok := s.filler.(refiller); ok { + if f, ok := s.baseF.(refiller); ok { f.SetRefill(amount) } } diff --git a/bar_option.go b/bar_option.go index 3f19527..ac45c02 100644 --- a/bar_option.go +++ b/bar_option.go @@ -80,7 +80,7 @@ // BarClearOnComplete clears bar filler only, on complete event. func BarClearOnComplete() BarOption { return func(s *bState) { - s.filler = makeClearOnCompleteFiller(s.filler) + s.filler = makeClearOnCompleteFiller(s.baseF) } } @@ -141,7 +141,7 @@ SetStyle(string) } return func(s *bState) { - if t, ok := s.filler.(styleSetter); ok { + if t, ok := s.baseF.(styleSetter); ok { t.SetStyle(style) } } @@ -161,7 +161,7 @@ SetReverse(bool) } return func(s *bState) { - if t, ok := s.filler.(revSetter); ok { + if t, ok := s.baseF.(revSetter); ok { t.SetReverse(true) } } @@ -191,7 +191,7 @@ cb func(interface{}), ) BarOption { return func(s *bState) { - if t, ok := typeChecker(s.filler); ok { + if t, ok := typeChecker(s.baseF); ok { cb(t) } } diff --git a/progress.go b/progress.go index db7d3e3..d6ed3f2 100644 --- a/progress.go +++ b/progress.go @@ -332,6 +332,7 @@ func (s *pState) makeBarState(total int64, filler Filler, options ...BarOption) *bState { bs := &bState{ total: total, + baseF: filler, filler: filler, priority: s.idCount, id: s.idCount,