mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-09 13:47:11 +02:00
moving loader and adding previous view function (unfinished)
This commit is contained in:
parent
f0447be989
commit
5dbe262d2d
9
gui.go
9
gui.go
@ -279,15 +279,6 @@ func fetch(g *gocui.Gui) {
|
|||||||
refreshStatus(g)
|
refreshStatus(g)
|
||||||
}
|
}
|
||||||
|
|
||||||
func loader() string {
|
|
||||||
characters := "|/-\\"
|
|
||||||
now := time.Now()
|
|
||||||
nanos := now.UnixNano()
|
|
||||||
index := nanos / 50000000 % int64(len(characters))
|
|
||||||
devLog(characters[index : index+1])
|
|
||||||
return characters[index : index+1]
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateLoader(g *gocui.Gui) {
|
func updateLoader(g *gocui.Gui) {
|
||||||
if confirmationView, _ := g.View("confirmation"); confirmationView != nil {
|
if confirmationView, _ := g.View("confirmation"); confirmationView != nil {
|
||||||
content := trimmedContent(confirmationView)
|
content := trimmedContent(confirmationView)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
)
|
)
|
||||||
@ -40,6 +41,29 @@ func nextView(g *gocui.Gui, v *gocui.View) error {
|
|||||||
return switchFocus(g, v, focusedView)
|
return switchFocus(g, v, focusedView)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func previousView(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
var focusedViewName string
|
||||||
|
if v == nil || v.Name() == cyclableViews[len(cyclableViews)-1] {
|
||||||
|
focusedViewName = cyclableViews[0]
|
||||||
|
} else {
|
||||||
|
for i := range cyclableViews {
|
||||||
|
if v.Name() == cyclableViews[i] {
|
||||||
|
focusedViewName = cyclableViews[i-1] // TODO: make this work properly
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if i == len(cyclableViews)-1 {
|
||||||
|
devLog(v.Name() + " is not in the list of views")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
focusedView, err := g.View(focusedViewName)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return switchFocus(g, v, focusedView)
|
||||||
|
}
|
||||||
|
|
||||||
func newLineFocused(g *gocui.Gui, v *gocui.View) error {
|
func newLineFocused(g *gocui.Gui, v *gocui.View) error {
|
||||||
mainView, _ := g.View("main")
|
mainView, _ := g.View("main")
|
||||||
mainView.SetOrigin(0, 0)
|
mainView.SetOrigin(0, 0)
|
||||||
@ -198,3 +222,11 @@ func optionsMapToString(optionsMap map[string]string) string {
|
|||||||
func renderOptionsMap(g *gocui.Gui, optionsMap map[string]string) error {
|
func renderOptionsMap(g *gocui.Gui, optionsMap map[string]string) error {
|
||||||
return renderString(g, "options", optionsMapToString(optionsMap))
|
return renderString(g, "options", optionsMapToString(optionsMap))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func loader() string {
|
||||||
|
characters := "|/-\\"
|
||||||
|
now := time.Now()
|
||||||
|
nanos := now.UnixNano()
|
||||||
|
index := nanos / 50000000 % int64(len(characters))
|
||||||
|
return characters[index : index+1]
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user