summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorİbrahim Serdar Açıkgöz <serdaracikgoz86@gmail.com>2018-12-03 18:23:32 +0300
committerİbrahim Serdar Açıkgöz <serdaracikgoz86@gmail.com>2018-12-03 18:23:32 +0300
commit69a9e5addb0180a1a7b96058e19a639b5de02798 (patch)
tree4b184f8af067ce1b5116877de3935c07368d0226
parentrestyle on repository selection (diff)
downloadgitbatch-69a9e5addb0180a1a7b96058e19a639b5de02798.tar.gz
restyle continued on selections
-rw-r--r--pkg/gui/gui-util.go3
-rw-r--r--pkg/gui/gui.go3
-rw-r--r--pkg/gui/mainview.go6
-rw-r--r--pkg/gui/queuehandler.go2
-rw-r--r--pkg/gui/textstyle.go22
5 files changed, 19 insertions, 17 deletions
diff --git a/pkg/gui/gui-util.go b/pkg/gui/gui-util.go
index adac98a..c09ae6c 100644
--- a/pkg/gui/gui-util.go
+++ b/pkg/gui/gui-util.go
@@ -21,9 +21,6 @@ func (gui *Gui) refreshViews(g *gocui.Gui, entity *git.RepoEntity) error {
if err = gui.updateCommits(g, entity); err != nil {
return err
}
- if err = gui.refreshMain(g); err != nil {
- return err
- }
return err
}
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 24a6cb6..c6950fb 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -143,9 +143,6 @@ func (gui *Gui) layout(g *gocui.Gui) error {
return err
}
v.Title = mainViewFeature.Title
- // v.Highlight = true
- // v.SelBgColor = gocui.ColorWhite
- // v.SelFgColor = gocui.ColorGreen
v.Overwrite = true
}
if v, err := g.SetView(remoteViewFeature.Name, int(0.55*float32(maxX)), 0, maxX-1, int(0.10*float32(maxY))); err != nil {
diff --git a/pkg/gui/mainview.go b/pkg/gui/mainview.go
index 4d4094a..e9bd1f3 100644
--- a/pkg/gui/mainview.go
+++ b/pkg/gui/mainview.go
@@ -52,6 +52,9 @@ func (gui *Gui) cursorDown(g *gocui.Gui, v *gocui.View) error {
}
}
entity := gui.getSelectedRepository()
+ if err := gui.refreshMain(g); err != nil {
+ return err
+ }
gui.refreshViews(g, entity)
}
return nil
@@ -68,6 +71,9 @@ func (gui *Gui) cursorUp(g *gocui.Gui, v *gocui.View) error {
}
}
entity := gui.getSelectedRepository()
+ if err := gui.refreshMain(g); err != nil {
+ return err
+ }
gui.refreshViews(g, entity)
}
return nil
diff --git a/pkg/gui/queuehandler.go b/pkg/gui/queuehandler.go
index 0d30d63..cbbc372 100644
--- a/pkg/gui/queuehandler.go
+++ b/pkg/gui/queuehandler.go
@@ -8,8 +8,8 @@ import (
// operation
func (gui *Gui) startQueue(g *gocui.Gui, v *gocui.View) error {
go func(gui_go *Gui, g_go *gocui.Gui) {
- indicateQueueStarted(g_go)
for {
+ indicateQueueStarted(g_go)
job, finished, err := gui_go.State.Queue.StartNext()
g_go.Update(func(gu *gocui.Gui) error {
gui_go.refreshMain(gu)
diff --git a/pkg/gui/textstyle.go b/pkg/gui/textstyle.go
index 1f582b5..554a590 100644
--- a/pkg/gui/textstyle.go
+++ b/pkg/gui/textstyle.go
@@ -27,8 +27,8 @@ var (
ws = " "
pushable = string(blue.Sprint("↖"))
pullable = string(blue.Sprint("↘"))
- confidentArrow = string(magenta.Sprint("→"))
- unconfidentArrow = string(yellow.Sprint("→"))
+ confidentArrow = string(magenta.Sprint(""))
+ unconfidentArrow = string(yellow.Sprint(""))
dirty = string(yellow.Sprint("✗"))
unknown = magenta.Sprint("?")
@@ -44,8 +44,8 @@ var (
modeSeperator = ""
keyBindingSeperator = "░"
- selectionIndicator = string(green.Sprint("→")) + ws
- tab = ws + ws
+ selectionIndicator = ws + string(green.Sprint("→")) + ws
+ tab = ws
)
// this function handles the render and representation of the repository
@@ -54,19 +54,21 @@ func (gui *Gui) displayString(entity *git.RepoEntity) string {
suffix := ""
prefix := ""
repoName := ""
+
if entity.Branch.Pushables != "?" {
- prefix = prefix + pushable + ws + entity.Branch.Pushables + ws +
- pullable + ws + entity.Branch.Pullables
+ prefix = prefix + pushable + ws + entity.Branch.Pushables +
+ ws + pullable + ws + entity.Branch.Pullables
} else {
- prefix = prefix + pushable + ws + yellow.Sprint(entity.Branch.Pushables) + ws +
- pullable + ws + yellow.Sprint(entity.Branch.Pullables)
+ prefix = prefix + pushable + ws + yellow.Sprint(entity.Branch.Pushables) +
+ ws + pullable + ws + yellow.Sprint(entity.Branch.Pullables)
}
+
selectedEntity := gui.getSelectedRepository()
if selectedEntity == entity {
- prefix = prefix + ws + selectionIndicator
+ prefix = prefix + selectionIndicator
repoName = green.Sprint(entity.Name)
} else {
- prefix = prefix + ws + ws + ws
+ prefix = prefix + ws
repoName = entity.Name
}
// some branch names can be really long, in that times I hope the first