From 4fbc998a41de6a4021a61a996b29ec2e49686d4e Mon Sep 17 00:00:00 2001 From: Sergey Ponomarev Date: Mon, 23 Nov 2020 14:27:47 +0200 Subject: [PATCH] status.go: simplify Buffer() s.health and s.status are always have only one element with a single char length --- cwidgets/compact/status.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/cwidgets/compact/status.go b/cwidgets/compact/status.go index b5bb261..783cd0e 100644 --- a/cwidgets/compact/status.go +++ b/cwidgets/compact/status.go @@ -32,16 +32,8 @@ func NewStatus() CompactCol { func (s *Status) Buffer() ui.Buffer { buf := s.Block.Buffer() - x := 0 - for _, c := range s.health { - buf.Set(s.InnerX()+x, s.InnerY(), c) - x += c.Width() - } - x += 1 - for _, c := range s.status { - buf.Set(s.InnerX()+x, s.InnerY(), c) - x += c.Width() - } + buf.Set(s.InnerX(), s.InnerY(), s.health[0]) + buf.Set(s.InnerX()+2, s.InnerY(), s.status[0]) return buf }