fix: fix height overflow in blobs tui
354f6574
2 file(s) · +13 −5
| 179 | 179 | if m.showPreview { |
|
| 180 | 180 | pw := m.width - listW |
|
| 181 | 181 | m.preview.SetWidth(max(pw-fw, 1)) |
|
| 182 | - | m.preview.SetHeight(max(bodyH-fh, 1)) |
|
| 182 | + | m.preview.SetHeight(max(bodyH-fh-1, 1)) |
|
| 183 | 183 | } |
|
| 184 | 184 | } |
|
| 185 | 185 | } |
| 27 | 27 | return tea.View{Content: "loading...", AltScreen: true} |
|
| 28 | 28 | } |
|
| 29 | 29 | ||
| 30 | + | bodyH := m.height - 2 |
|
| 31 | + | if bodyH < 5 { |
|
| 32 | + | bodyH = 5 |
|
| 33 | + | } |
|
| 34 | + | ||
| 30 | 35 | var body string |
|
| 31 | 36 | switch m.state { |
|
| 32 | 37 | case stateBuckets: |
|
| 33 | - | body = paneBorderActive.Width(m.width - paneFrameW()).Height(m.height - 2 - paneFrameH()).Render(m.bucketsList.View()) |
|
| 38 | + | body = paneBorderActive.Width(m.width).Height(bodyH).Render(m.bucketsList.View()) |
|
| 34 | 39 | case stateBrowse: |
|
| 35 | 40 | body = m.renderBrowse() |
|
| 36 | 41 | } |
|
| 78 | 83 | ||
| 79 | 84 | func (m tuiModel) renderBrowse() string { |
|
| 80 | 85 | bodyH := m.height - 2 |
|
| 86 | + | if bodyH < 5 { |
|
| 87 | + | bodyH = 5 |
|
| 88 | + | } |
|
| 81 | 89 | if !m.showPreview { |
|
| 82 | - | return paneBorderActive.Width(m.width - paneFrameW()).Height(bodyH - paneFrameH()).Render(m.browseList.View()) |
|
| 90 | + | return paneBorderActive.Width(m.width).Height(bodyH).Render(m.browseList.View()) |
|
| 83 | 91 | } |
|
| 84 | 92 | listW := m.width / 2 |
|
| 85 | 93 | previewW := m.width - listW |
|
| 86 | - | left := paneBorderActive.Width(listW - paneFrameW()).Height(bodyH - paneFrameH()).Render(m.browseList.View()) |
|
| 94 | + | left := paneBorderActive.Width(listW).Height(bodyH).Render(m.browseList.View()) |
|
| 87 | 95 | header := tuiTitleStyle.Render("preview") |
|
| 88 | 96 | previewBody := m.preview.View() |
|
| 89 | 97 | inner := lipgloss.JoinVertical(lipgloss.Left, header, previewBody) |
|
| 90 | - | right := paneBorder.Width(previewW - paneFrameW()).Height(bodyH - paneFrameH()).Render(inner) |
|
| 98 | + | right := paneBorder.Width(previewW).Height(bodyH).Render(inner) |
|
| 91 | 99 | return lipgloss.JoinHorizontal(lipgloss.Top, left, right) |
|
| 92 | 100 | } |
|
| 93 | 101 | ||