mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
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:
@@ -32,16 +32,8 @@ func NewStatus() CompactCol {
|
|||||||
|
|
||||||
func (s *Status) Buffer() ui.Buffer {
|
func (s *Status) Buffer() ui.Buffer {
|
||||||
buf := s.Block.Buffer()
|
buf := s.Block.Buffer()
|
||||||
x := 0
|
buf.Set(s.InnerX(), s.InnerY(), s.health[0])
|
||||||
for _, c := range s.health {
|
buf.Set(s.InnerX()+2, s.InnerY(), s.status[0])
|
||||||
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()
|
|
||||||
}
|
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user