Skip to content

Commit

Permalink
fix(viewport): pad width to contentWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvc authored and maaslalani committed Jan 8, 2024
1 parent f36aa3c commit 1ba1200
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion viewport/viewport.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,10 @@ func (m Model) View() string {
contentWidth := w - m.Style.GetHorizontalFrameSize()
contentHeight := h - m.Style.GetVerticalFrameSize()
contents := lipgloss.NewStyle().
Width(contentWidth). // pad to width.
Height(contentHeight). // pad to height.
MaxHeight(contentHeight). // truncate height if taller.
MaxWidth(contentWidth). // truncate width.
MaxWidth(contentWidth). // truncate width if wider.
Render(strings.Join(m.visibleLines(), "\n"))
return m.Style.Copy().
UnsetWidth().UnsetHeight(). // Style size already applied in contents.
Expand Down

0 comments on commit 1ba1200

Please sign in to comment.