status.go: simplify Buffer()

s.health and s.status are always have only one element with a single char length
This commit is contained in:
Sergey Ponomarev 2020-11-23 14:27:47 +02:00
parent 117c3bc7b5
commit 4fbc998a41
1 changed files with 2 additions and 10 deletions

View File

@ -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
}