charmbracelet / charmbracelet/bubbles

List : list panel pushed into title/status panels by padding on items

Open
#503 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
8.9k
Forks
457
Avg merge
1d 18h
Merged PRs (30d)
5

Description

**Describe the bug**
Adding padding to items in a list pushes the listing panel up into the filter/status area.
I'd expect padding to instead push the list down from the top of the pagination panel.
This issue also affects lists utilizing custom list delegates.

**Setup**
My environment:
- Linux 6.5.0-5-amd64
- bash 5.2.21-2
- rxvt-unicode 9.31-3
- Locale is en_GB.UTF-8

**To Reproduce**
Add padding to the Title elements.

**Source Code**
Add the following to the bubbletea [list bubble default example](https://github.com/charmbracelet/bubbletea/blob/master/examples/list-default/main.go) to replace the model initialisation line:

```go
ddStyles := list.NewDefaultItemStyles()
ddStyles.NormalTitle.PaddingTop(1)
ddStyles.DimmedTitle.PaddingTop(1)
ddStyles.SelectedTitle.PaddingTop(1)
ndd := func() list.DefaultDelegate {
ldd := list.DefaultDelegate{
ShowDescription: true,
Styles: ddStyles,
}
ldd.SetHeight(2)
ldd.SetSpacing(1)
return ldd
}
m := model{list: list.New(items, ndd(), 0, 0)} // model initialisation
```
A runnable version can be found [here](https://gist.github.com/rorycl/264a56ab4e4d15c07c63cb5fc651f771#file-list-go-L77)

**Expected behavior**
The status and title panels should remain visible.

**Screenshots**
Expected (although this shows no padding):
![normal](https://github.com/charmbracelet/bubbles/assets/646722/3ac677c0-6362-4faa-8c95-985bc4db71a8)
Problem output (padding causes the top title and status panels to be hidden):
![problem](https://github.com/charmbracelet/bubbles/assets/646722/c6c0f6b9-577e-4b31-aeaf-b72d3c1448f0)
Attempting to differentiate headings in list items by adding padding is what exposed this issue.
![use-case](https://github.com/charmbracelet/bubbles/assets/646722/cd8c6f04-db58-43eb-adde-8b510208ccd1)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.