Skip to content

Commit

Permalink
add SetViewBeneath function
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed May 5, 2019
1 parent 91337fd commit bac774b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ func (g *Gui) SetView(name string, x0, y0, x1, y1 int, overlaps byte) (*View, er
return v, errors.Wrap(ErrUnknownView, 0)
}

// SetViewBeneath sets a view stacked beneath another view
func (g *Gui) SetViewBeneath(name string, aboveViewName string, height int) (*View, error) {
aboveView, err := g.View(aboveViewName)
if err != nil {
return nil, err
}

viewTop := aboveView.y1 + 1
return g.SetView(name, aboveView.x0, viewTop, aboveView.x1, viewTop+height-1, 0)
}

// SetViewOnTop sets the given view on top of the existing ones.
func (g *Gui) SetViewOnTop(name string) (*View, error) {
for i, v := range g.views {
Expand Down

0 comments on commit bac774b

Please sign in to comment.