From f8b3922524b93599faaa2a464a8075279f141786 Mon Sep 17 00:00:00 2001 From: bashbunni Date: Wed, 27 Nov 2024 14:05:10 -0800 Subject: [PATCH] Revert "fix: calculate offset from previous field heights" This reverts commit b41c5e7b7109638d27b6324aff64db27a13188cd. --- group.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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)