aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/awesome-gocui/gocui/loader.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-05 22:03:19 +0100
committerMichael Muré <batolettre@gmail.com>2020-02-05 22:33:03 +0100
commit1d4bb7ceb0cef79d68df0bacc913b01e40e6ddd6 (patch)
treee088b0fa43058afde1db71541d8fcb4b94905d6e /vendor/github.com/awesome-gocui/gocui/loader.go
parentf093be96e98284580d61664adecd0a2ff8b354e4 (diff)
downloadgit-bug-1d4bb7ceb0cef79d68df0bacc913b01e40e6ddd6.tar.gz
migrate to go modules
Diffstat (limited to 'vendor/github.com/awesome-gocui/gocui/loader.go')
-rw-r--r--vendor/github.com/awesome-gocui/gocui/loader.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/vendor/github.com/awesome-gocui/gocui/loader.go b/vendor/github.com/awesome-gocui/gocui/loader.go
deleted file mode 100644
index d6715ac6..00000000
--- a/vendor/github.com/awesome-gocui/gocui/loader.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package gocui
-
-import "time"
-
-func (g *Gui) loaderTick() {
- go func() {
- for range time.Tick(time.Millisecond * 50) {
- for _, view := range g.Views() {
- if view.HasLoader {
- g.userEvents <- userEvent{func(g *Gui) error { return nil }}
- break
- }
- }
- }
- }()
-}
-
-func (v *View) loaderLines() [][]cell {
- duplicate := make([][]cell, len(v.lines))
- for i := range v.lines {
- if i < len(v.lines)-1 {
- duplicate[i] = make([]cell, len(v.lines[i]))
- copy(duplicate[i], v.lines[i])
- } else {
- duplicate[i] = make([]cell, len(v.lines[i])+2)
- copy(duplicate[i], v.lines[i])
- duplicate[i][len(duplicate[i])-2] = cell{chr: ' '}
- duplicate[i][len(duplicate[i])-1] = Loader()
- }
- }
-
- return duplicate
-}
-
-// Loader can show a loading animation
-func Loader() cell {
- characters := "|/-\\"
- now := time.Now()
- nanos := now.UnixNano()
- index := nanos / 50000000 % int64(len(characters))
- str := characters[index : index+1]
- chr := []rune(str)[0]
- return cell{
- chr: chr,
- }
-}