From 1090d326e8c85a07b5ec35d363e4ebdf67f85a54 Mon Sep 17 00:00:00 2001 From: Caleb Bassi Date: Wed, 11 Apr 2018 11:53:38 -0700 Subject: [PATCH] Update termui to fix table bug --- Gopkg.lock | 2 +- vendor/github.com/cjbassi/termui/table.go | 6 +++--- vendor/github.com/cjbassi/termui/utils.go | 7 +++++++ widgets/cpu.go | 2 +- widgets/net.go | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 438d9b8..4e588d5 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -17,7 +17,7 @@ branch = "master" name = "github.com/cjbassi/termui" packages = ["."] - revision = "b7a9b813b6a3bb09604fe10853cfd437291f20a1" + revision = "f1b2f22c3713217ceeb39b297418fabce7bb7e6e" [[projects]] branch = "master" diff --git a/vendor/github.com/cjbassi/termui/table.go b/vendor/github.com/cjbassi/termui/table.go index d86798c..79dd6f2 100644 --- a/vendor/github.com/cjbassi/termui/table.go +++ b/vendor/github.com/cjbassi/termui/table.go @@ -58,9 +58,9 @@ func (self *Table) Buffer() *Buffer { buf := self.Block.Buffer() // removes gap at the bottom of the current view if there is one - if self.TopRow > len(self.Rows)-(self.Y-1) { - self.TopRow = len(self.Rows) - (self.Y - 1) - } + // if self.TopRow > len(self.Rows)-(self.Y-1) { + // self.TopRow = len(self.Rows) - (self.Y - 1) + // } self.ColResizer() diff --git a/vendor/github.com/cjbassi/termui/utils.go b/vendor/github.com/cjbassi/termui/utils.go index 614828b..bfb0502 100644 --- a/vendor/github.com/cjbassi/termui/utils.go +++ b/vendor/github.com/cjbassi/termui/utils.go @@ -34,3 +34,10 @@ func Error(issue, diagnostics string) { fmt.Println() panic(1) } + +func Max(x, y int) int { + if x > y { + return x + } + return y +} diff --git a/widgets/cpu.go b/widgets/cpu.go index b84af2c..0533218 100644 --- a/widgets/cpu.go +++ b/widgets/cpu.go @@ -12,7 +12,7 @@ import ( type CPU struct { *ui.LineGraph - Count int // number of CPUs + Count int // number of cores interval time.Duration } diff --git a/widgets/net.go b/widgets/net.go index 1155db3..c2e5698 100644 --- a/widgets/net.go +++ b/widgets/net.go @@ -55,7 +55,7 @@ func (self *Net) update() { self.Lines[0].Data = append(self.Lines[0].Data, int(recvRecent)) self.Lines[1].Data = append(self.Lines[1].Data, int(sentRecent)) - if recvRecent < 0 || sentRecent < 0 { + if int(recvRecent) < 0 || int(sentRecent) < 0 { utils.Error("net data", fmt.Sprint( "curRecvTotal: ", curRecvTotal, "\n",