Change paginator dots when no entry

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-05-18 23:33:30 +02:00
parent 789a513469
commit 3b6b58ac2b
10 changed files with 61 additions and 16 deletions
+6 -1
View File
@@ -19,7 +19,12 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if m.cursor >= len(m.findings) {
m.cursor = max(0, len(m.findings)-1)
}
m.pager.SetTotalPages(len(m.findings))
if len(m.findings) == 0 {
m.pager.Page = 0
m.pager.TotalPages = 0
} else {
m.pager.SetTotalPages(len(m.findings))
}
m.refreshListViewport()
m.refreshBody()
return m, nil
+4 -1
View File
@@ -28,7 +28,10 @@ func (m Model) View() tea.View {
func (m *Model) renderListPanel(w, h int) string {
s := style.S
dots := s.Faint.Render(m.pager.View())
var dots string
if len(m.findings) > 0 {
dots = s.Faint.Render(m.pager.View())
}
inner := lipgloss.JoinVertical(lipgloss.Left,
m.listViewport.View(),
lipgloss.PlaceHorizontal(m.listViewport.Width(), lipgloss.Center, dots),