()
| 245 | } |
| 246 | |
| 247 | func (d *themePickerDialog) View() string { |
| 248 | dialogWidth, _, contentWidth := d.dialogSize() |
| 249 | d.textInput.SetWidth(contentWidth) |
| 250 | |
| 251 | gl := d.buildList(contentWidth) |
| 252 | d.updateScrollviewPosition() |
| 253 | d.scrollview.SetContent(gl.Lines(), len(gl.Lines())) |
| 254 | |
| 255 | scrollableContent := d.scrollview.View() |
| 256 | if len(d.filtered) == 0 { |
| 257 | scrollableContent = d.renderEmptyState("No themes found", contentWidth) |
| 258 | } |
| 259 | |
| 260 | content := NewContent(d.regionWidth(contentWidth)). |
| 261 | AddTitle("Select Theme"). |
| 262 | AddSpace(). |
| 263 | AddContent(d.textInput.View()). |
| 264 | AddSeparator(). |
| 265 | AddContent(scrollableContent). |
| 266 | AddSpace(). |
| 267 | AddHelpKeys("↑/↓", "navigate", "enter", "select", "esc", "cancel"). |
| 268 | Build() |
| 269 | |
| 270 | return styles.DialogStyle.Width(dialogWidth).Render(content) |
| 271 | } |
| 272 | |
| 273 | func (d *themePickerDialog) renderTheme(theme ThemeChoice, selected bool, maxWidth int) string { |
| 274 | if maxWidth <= 0 { |
nothing calls this directly
no test coverage detected