diff options
author | Caleb Bassi <calebjbassi@gmail.com> | 2018-03-27 14:27:23 -0700 |
---|---|---|
committer | Caleb Bassi <calebjbassi@gmail.com> | 2018-03-27 14:27:23 -0700 |
commit | dc8cc5aa4db5cc08ae01b2ce48b6d310b98e858f (patch) | |
tree | 32a769dd4a6c4beec588571a164fc5cdc7ef4600 /termui/gauge.go | |
parent | 0aa09f4fc6afc71624c8956bdfdd80a72b808cb0 (diff) |
Change methods to use 'self' keyword
Diffstat (limited to 'termui/gauge.go')
-rw-r--r-- | termui/gauge.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/termui/gauge.go b/termui/gauge.go index 1896871..a5b3b2a 100644 --- a/termui/gauge.go +++ b/termui/gauge.go @@ -21,27 +21,27 @@ func NewGauge() *Gauge { } // Buffer implements Bufferer interface. -func (g *Gauge) Buffer() *Buffer { - buf := g.Block.Buffer() +func (self *Gauge) Buffer() *Buffer { + buf := self.Block.Buffer() // plot bar - width := g.Percent * g.X / 100 - for y := 1; y <= g.Y; y++ { + width := self.Percent * self.X / 100 + for y := 1; y <= self.Y; y++ { for x := 1; x <= width; x++ { - buf.SetCell(x, y, Cell{' ', g.GaugeColor, g.GaugeColor}) + buf.SetCell(x, y, Cell{' ', self.GaugeColor, self.GaugeColor}) } } // plot percentage - s := strconv.Itoa(g.Percent) + "%" + g.Description - s = MaxString(s, g.X) - y := (g.Y + 1) / 2 - x := ((g.X - len(s)) + 1) / 2 + s := strconv.Itoa(self.Percent) + "%" + self.Description + s = MaxString(s, self.X) + y := (self.Y + 1) / 2 + x := ((self.X - len(s)) + 1) / 2 for i, char := range s { - bg := g.Bg - fg := g.Fg + bg := self.Bg + fg := self.Fg if x+i < width { - fg = g.GaugeColor + fg = self.GaugeColor bg = AttrReverse } buf.SetCell(1+x+i, y, Cell{char, fg, bg}) |