summaryrefslogtreecommitdiffstats
path: root/termui/sparkline.go
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-05-31 15:48:14 -0500
committerSean E. Russell <ser@ser1.net>2020-05-31 16:09:51 -0500
commit44b5d2d6eca94aa2329f07e2e5525577344ece7d (patch)
tree68c9b0b4f4c1a55f5d910b4d6b2e50d10a99c1b4 /termui/sparkline.go
parent5123568b923991f9fba318954ea3e8cf6785e252 (diff)
Fixes #128 for LineGraph; there's probably another leak in Sparkline
Fixes #128 for Sparkline. Also, the amount of data held is tiny so bumped the buffer to 4x to reduce collections. Minor comment change
Diffstat (limited to 'termui/sparkline.go')
-rw-r--r--termui/sparkline.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/termui/sparkline.go b/termui/sparkline.go
index 2f27d9e..3b3ad75 100644
--- a/termui/sparkline.go
+++ b/termui/sparkline.go
@@ -98,5 +98,9 @@ func (self *SparklineGroup) Draw(buf *Buffer) {
image.Pt(self.Inner.Min.X+x-1, self.Inner.Min.Y+sparkY-1),
)
}
+ dx := self.Inner.Dx()
+ if len(line.Data) > 4*dx {
+ line.Data = line.Data[dx-1:]
+ }
}
}