diff --git a/group.go b/group.go index 92bf2c0..b4973b5 100644 --- a/group.go +++ b/group.go @@ -296,18 +296,18 @@ func (g *Group) fullHeight() int { func (g *Group) getContent() (int, string) { var fields strings.Builder - var offset int + offset := 0 + gap := "\n\n" - // If the focused field is requesting it be zoomed, only show that field. + // if the focused field is requesting it be zoomed, only show that field. if g.selector.Selected().Zoom() { g.selector.Selected().WithHeight(g.height - 1) fields.WriteString(g.selector.Selected().View()) } else { g.selector.Range(func(i int, field Field) bool { fields.WriteString(field.View()) - // Set the offset to the height of the previous field(s). - if i < g.selector.Index() { - offset += lipgloss.Height(field.View()) + if i == g.selector.Index() { + offset = lipgloss.Height(fields.String()) - lipgloss.Height(field.View()) } if i < g.selector.Total()-1 { fields.WriteString(gap)