summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/cjbassi
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/cjbassi')
-rw-r--r--vendor/github.com/cjbassi/termui/README.md2
-rw-r--r--vendor/github.com/cjbassi/termui/colors.go34
-rw-r--r--vendor/github.com/cjbassi/termui/table.go30
3 files changed, 33 insertions, 33 deletions
diff --git a/vendor/github.com/cjbassi/termui/README.md b/vendor/github.com/cjbassi/termui/README.md
index 8b8e291..6ac814c 100644
--- a/vendor/github.com/cjbassi/termui/README.md
+++ b/vendor/github.com/cjbassi/termui/README.md
@@ -5,7 +5,7 @@ A fork of [termui](https://github.com/gizak/termui) with a lot of code cleanup a
You can see an implementation/example usage of this library [here](https://github.com/cjbassi/gotop).
Some usage improvements include:
-* better event/keypress names
+* better event/key-combo names
* more convenient event handling function
* 256 colors
* better grid system
diff --git a/vendor/github.com/cjbassi/termui/colors.go b/vendor/github.com/cjbassi/termui/colors.go
index 3af2469..7913a67 100644
--- a/vendor/github.com/cjbassi/termui/colors.go
+++ b/vendor/github.com/cjbassi/termui/colors.go
@@ -13,25 +13,6 @@ const (
AttrReverse
)
-// Theme is assigned to the current theme.
-var Theme = DefaultTheme
-
-// DefaultTheme implements a generic set of colors to use by default.
-var DefaultTheme = Colorscheme{
- Fg: 7,
- Bg: -1,
-
- LabelFg: 7,
- LabelBg: -1,
- BorderFg: 6,
- BorderBg: -1,
-
- Sparkline: 4,
- LineGraph: 0,
- TableCursor: 4,
- GaugeColor: 7,
-}
-
// A Colorscheme represents the current look-and-feel of the dashboard.
type Colorscheme struct {
Fg Color
@@ -47,3 +28,18 @@ type Colorscheme struct {
TableCursor Color
GaugeColor Color
}
+
+var Theme = Colorscheme{
+ Fg: 7,
+ Bg: -1,
+
+ LabelFg: 7,
+ LabelBg: -1,
+ BorderFg: 6,
+ BorderBg: -1,
+
+ Sparkline: 4,
+ LineGraph: 0,
+ TableCursor: 4,
+ GaugeColor: 7,
+}
diff --git a/vendor/github.com/cjbassi/termui/table.go b/vendor/github.com/cjbassi/termui/table.go
index 1e962a6..816363a 100644
--- a/vendor/github.com/cjbassi/termui/table.go
+++ b/vendor/github.com/cjbassi/termui/table.go
@@ -8,17 +8,21 @@ import (
// Table tracks all the attributes of a Table instance
type Table struct {
*Block
- Header []string
- Rows [][]string
- ColWidths []int
- CellXPos []int // column position
- Gap int // gap between columns
- Cursor Color
+
+ Header []string
+ Rows [][]string
+
+ ColWidths []int
+ CellXPos []int // column position
+ ColResizer func() // for widgets that inherit a Table and want to overload the ColResize method
+ Gap int // gap between columns
+
+ Cursor Color
+
UniqueCol int // the column used to identify the selected item
SelectedItem string // used to keep the cursor on the correct item if the data changes
SelectedRow int
- TopRow int // used to indicate where in the table we are scrolled at
- ColResizer func() // for widgets that inherit a Table and want to overload the ColResize method
+ TopRow int // used to indicate where in the table we are scrolled at
}
// NewTable returns a new Table instance
@@ -63,9 +67,9 @@ func (self *Table) Buffer() *Buffer {
for i, h := range self.Header {
width := self.ColWidths[i]
if width == 0 {
- break
+ continue
}
- h = MaxString(h, self.X-6)
+ h = MaxString(h, self.X-self.CellXPos[i])
buf.SetString(self.CellXPos[i], 1, h, self.Fg|AttrBold, self.Bg)
}
@@ -89,7 +93,7 @@ func (self *Table) Buffer() *Buffer {
bg = self.Cursor
for _, width := range self.ColWidths {
if width == 0 {
- break
+ continue
}
buf.SetString(1, y, strings.Repeat(" ", self.X), self.Fg, bg)
}
@@ -100,9 +104,9 @@ func (self *Table) Buffer() *Buffer {
// prints each col of the row
for i, width := range self.ColWidths {
if width == 0 {
- break
+ continue
}
- r := MaxString(row[i], self.X-6)
+ r := MaxString(row[i], self.X-self.CellXPos[i])
buf.SetString(self.CellXPos[i], y, r, self.Fg, bg)
}
}