Skip to content

Commit

Permalink
Merge Jesseduffield's (#1)
Browse files Browse the repository at this point in the history
Merge Jesseduffield's

Co-authored-by: Jesse Duffield <[email protected]>
  • Loading branch information
mjarkk and jesseduffield authored May 6, 2019
2 parents af5a758 + bac774b commit b9fc59d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 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 Expand Up @@ -561,6 +572,14 @@ func corner(v *View, directions byte) rune {
// drawFrameCorners draws the corners of the view.
func (g *Gui) drawFrameCorners(v *View, fgColor, bgColor Attribute) error {
if v.y0 == v.y1 {
if !g.SupportOverlaps {
if err := g.SetRune(v.x0, v.y0, '╶', fgColor, bgColor); err != nil {
return err
}
if err := g.SetRune(v.x1, v.y0, '╴', fgColor, bgColor); err != nil {
return err
}
}
return nil
}

Expand Down

0 comments on commit b9fc59d

Please sign in to comment.