Skip to content

Commit

Permalink
fix(table): substract headers Y size from the total table size (#434)
Browse files Browse the repository at this point in the history
* fix(table): substract headers Y size from the total table size

* fix: change GetFrameSize to GetVerticalFrameSize and calc header height

* fix: remove GetVerticalFrameSize at all

* fix: account for headers in height WithHeight, SetHeight

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
  • Loading branch information
prgres and maaslalani committed Mar 13, 2024
1 parent 961c081 commit 6dbfc82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func WithRows(rows []Row) Option {
// WithHeight sets the height of the table.
func WithHeight(h int) Option {
return func(m *Model) {
m.viewport.Height = h
m.viewport.Height = h - lipgloss.Height(m.headersView())
}
}

Expand Down Expand Up @@ -314,7 +314,7 @@ func (m *Model) SetWidth(w int) {

// SetHeight sets the height of the viewport of the table.
func (m *Model) SetHeight(h int) {
m.viewport.Height = h
m.viewport.Height = h - lipgloss.Height(m.headersView())
m.UpdateViewport()
}

Expand Down

0 comments on commit 6dbfc82

Please sign in to comment.