Skip to content

Commit

Permalink
Clean views and actions
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienBreux committed Aug 14, 2017
1 parent 0c4e336 commit d0f1e83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
7 changes: 5 additions & 2 deletions actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ func actionGlobalQuit(g *gocui.Gui, v *gocui.View) error {

// Global action: Toggle debug
func actionGlobalToggleDebug(g *gocui.Gui, v *gocui.View) error {
vn := "debug"

if !DEBUG_DISPLAYED {
debug(g, "Action: Toggle debug display (show)")
g.SetViewOnTop("debug")
g.SetViewOnTop(vn)
g.SetCurrentView(vn)
} else {
debug(g, "Action: Toggle debug display (hide)")
g.SetViewOnBottom("debug")
g.SetViewOnBottom(vn)
// TODO g.SetCurrentView("pods")
}

Expand Down
11 changes: 2 additions & 9 deletions views.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,14 @@ func viewTitle(g *gocui.Gui, lMaxX int, lMaxY int) error {

// View: Debug
func viewDebug(g *gocui.Gui, lMaxX int, lMaxY int) error {
// Main view
minX := 2
maxX := lMaxX - 4
minY := 2
maxY := lMaxY - 2
if v, err := g.SetView("debug", minX, minY, maxX, maxY); err != nil {
if v, err := g.SetView("debug", 2, 2, lMaxX-4, lMaxY-2); err != nil {
if err != gocui.ErrUnknownView {
return err
}

// Configure view
// Settings
v.Title = " Debug "
v.Autoscroll = true
g.SetViewOnTop(v.Name())
g.SetCurrentView(v.Name())
}

return nil
Expand Down

0 comments on commit d0f1e83

Please sign in to comment.