Fix termui version

This commit is contained in:
erroneousboat 2018-03-30 14:59:23 +02:00
parent f1f0bc1379
commit 29201a8bb2
11 changed files with 25 additions and 21 deletions

5
Gopkg.lock generated
View File

@ -4,8 +4,7 @@
[[projects]]
name = "github.com/erroneousboat/termui"
packages = ["."]
revision = "24acd523c756fd9728824cdfac66aad9d8982fb7"
version = "v2.2.0"
revision = "80f245cdfa0488883a3e8602bf3f0c8a3c889a22"
[[projects]]
name = "github.com/gorilla/websocket"
@ -51,6 +50,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "719f2440551009ce6f1e1a7f6e56db762acdadd9a0e05245ee427b7455e50233"
inputs-digest = "353a2a71e00ecf8dd6123a02828c450fa6d38472a98792d2d8a4cd6349900f11"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -27,7 +27,7 @@
[[constraint]]
name = "github.com/erroneousboat/termui"
version = "2.2.0"
revision = "80f245cdfa0488883a3e8602bf3f0c8a3c889a22"
[[constraint]]
name = "github.com/mattn/go-runewidth"

View File

@ -62,7 +62,7 @@ func (bc *BarChart) layout() {
}
//bc.max = bc.Data[0] // what if Data is nil? Sometimes when bar graph is nill it produces panic with panic: runtime error: index out of range
// Asign a negative value to get maxvalue auto-populates
// Assign a negative value to get maxvalue auto-populates
if bc.max == 0 {
bc.max = -1
}

View File

@ -126,7 +126,7 @@ func hookTermboxEvt() {
e := termbox.PollEvent()
for _, c := range sysEvtChs {
go func(ch chan Event) {
func(ch chan Event) {
ch <- crtTermboxEvt(e)
}(c)
}
@ -221,6 +221,7 @@ func findMatch(mux map[string]func(Event), path string) string {
return pattern
}
// Remove all existing defined Handlers from the map
func (es *EvtStream) ResetHandlers() {
for Path, _ := range es.Handlers {
@ -243,7 +244,7 @@ func (es *EvtStream) Loop() {
case "/sig/stoploop":
return
}
go func(a Event) {
func(a Event) {
es.RLock()
defer es.RUnlock()
if pattern := es.match(a.Path); pattern != "" {
@ -273,6 +274,10 @@ func Handle(path string, handler func(Event)) {
DefaultEvtStream.Handle(path, handler)
}
func ResetHandlers() {
DefaultEvtStream.ResetHandlers()
}
func Loop() {
DefaultEvtStream.Loop()
}
@ -309,7 +314,7 @@ func NewTimerCh(du time.Duration) chan Event {
return t
}
var DefualtHandler = func(e Event) {
var DefaultHandler = func(e Event) {
}
var usrEvtCh = make(chan Event)

View File

@ -48,7 +48,7 @@ func (r *Row) assignWidth(w int) {
accW := 0 // acc span and offset
calcW := make([]int, len(r.Cols)) // calculated width
calcOftX := make([]int, len(r.Cols)) // computated start position of x
calcOftX := make([]int, len(r.Cols)) // computed start position of x
for i, c := range r.Cols {
accW += c.Span + c.Offset
@ -266,7 +266,7 @@ func (g *Grid) Align() {
}
}
// Buffer implments Bufferer interface.
// Buffer implements Bufferer interface.
func (g Grid) Buffer() Buffer {
buf := NewBuffer()

View File

@ -100,7 +100,7 @@ func charWidth(ch rune) int {
var whiteSpaceRegex = regexp.MustCompile(`\s`)
// StringToAttribute converts text to a termui attribute. You may specifiy more
// StringToAttribute converts text to a termui attribute. You may specify more
// then one attribute like that: "BLACK, BOLD, ...". All whitespaces
// are ignored.
func StringToAttribute(text string) Attribute {

View File

@ -35,7 +35,7 @@ var braillePatterns = map[[2]int]rune{
var lSingleBraille = [4]rune{'\u2840', '⠄', '⠂', '⠁'}
var rSingleBraille = [4]rune{'\u2880', '⠠', '⠐', '⠈'}
// LineChart has two modes: braille(default) and dot. Using braille gives 2x capicity as dot mode,
// LineChart has two modes: braille(default) and dot. Using braille gives 2x capacity as dot mode,
// because one braille char can represent two data points.
/*
lc := termui.NewLineChart()
@ -87,7 +87,7 @@ func NewLineChart() *LineChart {
}
// one cell contains two data points
// so the capicity is 2x as dot-mode
// so the capacity is 2x as dot-mode
func (lc *LineChart) renderBraille() Buffer {
buf := NewBuffer()

View File

@ -14,7 +14,7 @@ import "strings"
strs := []string{
"[0] github.com/gizak/termui",
"[1] editbox.go",
"[2] iterrupt.go",
"[2] interrupt.go",
"[3] keyboard.go",
"[4] output.go",
"[5] random_out.go",

View File

@ -8,7 +8,7 @@ import (
"fmt"
)
// This is the implemetation of multi-colored or stacked bar graph. This is different from default barGraph which is implemented in bar.go
// This is the implementation of multi-colored or stacked bar graph. This is different from default barGraph which is implemented in bar.go
// Multi-Colored-BarChart creates multiple bars in a widget:
/*
bc := termui.NewMBarChart()
@ -72,7 +72,7 @@ func (bc *MBarChart) layout() {
}
bc.numStack = DataLen
//We need to know what is the mimimum size of data array data[0] could have 10 elements data[1] could have only 5, so we plot only 5 bar graphs
//We need to know what is the minimum size of data array data[0] could have 10 elements data[1] could have only 5, so we plot only 5 bar graphs
for i := 0; i < DataLen; i++ {
if bc.minDataLen > len(bc.Data[i]) {
@ -90,13 +90,13 @@ func (bc *MBarChart) layout() {
for i := 0; i < bc.numStack; i++ {
bc.dataNum[i] = make([][]rune, len(bc.Data[i]))
//For each stack of bar calcualte the rune
//For each stack of bar calculate the rune
for j := 0; j < LabelLen && i < bc.numBar; j++ {
n := bc.Data[i][j]
s := fmt.Sprint(n)
bc.dataNum[i][j] = trimStr2Runes(s, bc.BarWidth)
}
//If color is not defined by default then populate a color that is different from the prevous bar
//If color is not defined by default then populate a color that is different from the previous bar
if bc.BarColor[i] == ColorDefault && bc.NumColor[i] == ColorDefault {
if i == 0 {
bc.BarColor[i] = ColorBlack

View File

@ -35,7 +35,7 @@ func Init() error {
}
sysEvtChs = make([]chan Event, 0)
go hookTermboxEvt()
// go hookTermboxEvt()
renderJobs = make(chan []Bufferer)
//renderLock = new(sync.RWMutex)
@ -51,7 +51,7 @@ func Init() error {
DefaultEvtStream.Merge("timer", NewTimerCh(time.Second))
DefaultEvtStream.Merge("custom", usrEvtCh)
DefaultEvtStream.Handle("/", DefualtHandler)
DefaultEvtStream.Handle("/", DefaultHandler)
DefaultEvtStream.Handle("/sys/wnd/resize", func(e Event) {
w := e.Data.(EvtWnd)
Body.Width = w.Width

View File

@ -51,7 +51,7 @@ func NewSparkline() Sparkline {
LineColor: ThemeAttr("sparkline.line.fg")}
}
// NewSparklines return a new *Spaklines with given Sparkline(s), you can always add a new Sparkline later.
// NewSparklines return a new *Sparklines with given Sparkline(s), you can always add a new Sparkline later.
func NewSparklines(ss ...Sparkline) *Sparklines {
s := &Sparklines{Block: *NewBlock(), Lines: ss}
return s