chore: tui style updates
a531a9d7
5 file(s) · +12 −18
| 53 | 53 | ready: true, |
|
| 54 | 54 | } |
|
| 55 | 55 | m.applyLayout() |
|
| 56 | + | if n, ok := m.list.Selected(); ok { |
|
| 57 | + | m.cont.SetNote(&n) |
|
| 58 | + | } |
|
| 56 | 59 | return m |
|
| 57 | 60 | } |
|
| 58 | 61 |
| 26 | 26 | return ansi.StyleConfig{ |
|
| 27 | 27 | Document: ansi.StyleBlock{ |
|
| 28 | 28 | StylePrimitive: ansi.StylePrimitive{BlockPrefix: "\n", BlockSuffix: "\n"}, |
|
| 29 | - | Margin: up(2), |
|
| 29 | + | Margin: up(0), |
|
| 30 | 30 | }, |
|
| 31 | 31 | BlockQuote: ansi.StyleBlock{ |
|
| 32 | 32 | Indent: up(1), |
| 68 | 68 | if m.state == stateList { |
|
| 69 | 69 | style = borderActive |
|
| 70 | 70 | } |
|
| 71 | - | return style. |
|
| 72 | - | Width(max(w-paneFrameWidth(), 1)). |
|
| 73 | - | Height(max(h-paneFrameHeight(), 1)). |
|
| 74 | - | Render(m.list.View()) |
|
| 71 | + | return style.Width(w).Height(h).Render(m.list.View()) |
|
| 75 | 72 | } |
|
| 76 | 73 | ||
| 77 | 74 | func (m Model) renderRightPane(w, h int) string { |
|
| 91 | 88 | header = t |
|
| 92 | 89 | } |
|
| 93 | 90 | inner := lipgloss.JoinVertical(lipgloss.Left, titleStyle.Render(header), m.cont.View()) |
|
| 94 | - | return style. |
|
| 95 | - | Width(max(w-paneFrameWidth(), 1)). |
|
| 96 | - | Height(max(h-paneFrameHeight(), 1)). |
|
| 97 | - | Render(inner) |
|
| 91 | + | return style.Width(w).Height(h).Render(inner) |
|
| 98 | 92 | } |
|
| 99 | 93 | ||
| 100 | 94 | func (m Model) renderForm(w, h int) string { |
|
| 118 | 112 | } |
|
| 119 | 113 | ||
| 120 | 114 | inner := lipgloss.JoinVertical(lipgloss.Left, titleStyle.Render(header), titleField, body) |
|
| 121 | - | return borderActive. |
|
| 122 | - | Width(max(w-paneFrameWidth(), 1)). |
|
| 123 | - | Height(max(h-paneFrameHeight(), 1)). |
|
| 124 | - | Render(inner) |
|
| 115 | + | return borderActive.Width(w).Height(h).Render(inner) |
|
| 125 | 116 | } |
|
| 126 | 117 | ||
| 127 | 118 | func (m Model) renderFooter() string { |
|
| 163 | 154 | if total < 44 { |
|
| 164 | 155 | return total / 2, total - (total / 2) |
|
| 165 | 156 | } |
|
| 166 | - | list := total * 30 / 100 |
|
| 157 | + | list := total / 4 |
|
| 167 | 158 | if list < 24 { |
|
| 168 | 159 | list = 24 |
|
| 169 | 160 | } |
|
| 279 | 279 | if listW < 24 { |
|
| 280 | 280 | listW = 24 |
|
| 281 | 281 | } |
|
| 282 | - | contentW := m.width - listW - 2 |
|
| 282 | + | contentW := m.width - listW |
|
| 283 | 283 | if contentW < 20 { |
|
| 284 | 284 | contentW = 20 |
|
| 285 | 285 | } |
|
| 286 | - | bodyH := m.height - 2 |
|
| 286 | + | bodyH := m.height - 1 |
|
| 287 | 287 | if bodyH < 5 { |
|
| 288 | 288 | bodyH = 5 |
|
| 289 | 289 | } |
| 28 | 28 | if listW < 24 { |
|
| 29 | 29 | listW = 24 |
|
| 30 | 30 | } |
|
| 31 | - | contentW := m.width - listW - 2 |
|
| 32 | - | bodyH := m.height - 2 |
|
| 31 | + | contentW := m.width - listW |
|
| 32 | + | bodyH := m.height - 1 |
|
| 33 | 33 | ||
| 34 | 34 | left := m.renderListPane(listW, bodyH) |
|
| 35 | 35 | right := m.renderRightPane(contentW, bodyH) |