Use personal fork of termui
This commit is contained in:
parent
4a4fb6b576
commit
eebee7027e
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/gizak/termui"
|
||||
"github.com/erroneousboat/termui"
|
||||
|
||||
"github.com/erroneousboat/slack-term/service"
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/gizak/termui"
|
||||
"github.com/erroneousboat/termui"
|
||||
|
||||
"github.com/erroneousboat/slack-term/config"
|
||||
"github.com/erroneousboat/slack-term/service"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package components
|
||||
|
||||
import (
|
||||
"github.com/gizak/termui"
|
||||
"github.com/erroneousboat/termui"
|
||||
|
||||
"github.com/erroneousboat/slack-term/service"
|
||||
)
|
||||
|
@ -1,6 +1,6 @@
|
||||
package components
|
||||
|
||||
import "github.com/gizak/termui"
|
||||
import "github.com/erroneousboat/termui"
|
||||
|
||||
// Mode is the definition of Mode component
|
||||
type Mode struct {
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"github.com/gizak/termui"
|
||||
"github.com/erroneousboat/termui"
|
||||
)
|
||||
|
||||
// Config is the definition of a Config struct
|
||||
|
@ -1,7 +1,7 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"github.com/gizak/termui"
|
||||
"github.com/erroneousboat/termui"
|
||||
termbox "github.com/nsf/termbox-go"
|
||||
|
||||
"github.com/erroneousboat/slack-term/config"
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gizak/termui"
|
||||
"github.com/erroneousboat/termui"
|
||||
"github.com/nlopes/slack"
|
||||
termbox "github.com/nsf/termbox-go"
|
||||
|
||||
@ -74,7 +74,7 @@ func handleTermboxEvents(ctx *context.AppContext, ev termbox.Event) bool {
|
||||
func handleMoreTermboxEvents(ctx *context.AppContext, ev termbox.Event) bool {
|
||||
for {
|
||||
select {
|
||||
case ev := <- ctx.EventQueue:
|
||||
case ev := <-ctx.EventQueue:
|
||||
ok := handleTermboxEvents(ctx, ev)
|
||||
if !ok {
|
||||
return false
|
||||
|
6
main.go
6
main.go
@ -8,11 +8,11 @@ import (
|
||||
"os/user"
|
||||
"path"
|
||||
|
||||
"github.com/erroneousboat/slack-term/context"
|
||||
"github.com/erroneousboat/slack-term/handlers"
|
||||
"github.com/erroneousboat/termui"
|
||||
termbox "github.com/nsf/termbox-go"
|
||||
|
||||
"github.com/gizak/termui"
|
||||
"github.com/erroneousboat/slack-term/context"
|
||||
"github.com/erroneousboat/slack-term/handlers"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -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
|
||||
}
|
@ -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)
|
||||
}
|
||||
@ -244,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 != "" {
|
||||
@ -274,6 +274,10 @@ func Handle(path string, handler func(Event)) {
|
||||
DefaultEvtStream.Handle(path, handler)
|
||||
}
|
||||
|
||||
func ResetHandlers() {
|
||||
DefaultEvtStream.ResetHandlers()
|
||||
}
|
||||
|
||||
func Loop() {
|
||||
DefaultEvtStream.Loop()
|
||||
}
|
@ -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()
|
||||
|
@ -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 {
|
@ -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()
|
||||
|
@ -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",
|
@ -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
|
@ -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 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
|
8
vendor/vendor.json
vendored
8
vendor/vendor.json
vendored
@ -3,10 +3,10 @@
|
||||
"ignore": "test",
|
||||
"package": [
|
||||
{
|
||||
"checksumSHA1": "0orwvPL96wFckVJyPl39fz2QsgA=",
|
||||
"path": "github.com/gizak/termui",
|
||||
"revision": "72304ddb9b4e9838426a021aad64a5a860e98324",
|
||||
"revisionTime": "2017-05-02T14:12:00Z"
|
||||
"checksumSHA1": "CbpC2ha+GTTuROMyyLVd/L3O+8Y=",
|
||||
"path": "github.com/erroneousboat/termui",
|
||||
"revision": "80f245cdfa0488883a3e8602bf3f0c8a3c889a22",
|
||||
"revisionTime": "2017-09-23T11:51:41Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "7hln62oZPZmyqEmgXaybf9WxQ7A=",
|
||||
|
@ -1,7 +1,7 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/gizak/termui"
|
||||
"github.com/erroneousboat/termui"
|
||||
|
||||
"github.com/erroneousboat/slack-term/components"
|
||||
"github.com/erroneousboat/slack-term/service"
|
||||
|
Loading…
Reference in New Issue
Block a user