diff --git a/internal/ui/app.go b/internal/ui/app.go index b70ca36..9631260 100644 --- a/internal/ui/app.go +++ b/internal/ui/app.go @@ -465,8 +465,7 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { cursor = min(msg.cursor, len(msg.rows)-1) } - m.table.SetCursor(0) - m.table.MoveDown(cursor) + m.table.SetCursor(cursor) } t := time.Now() diff --git a/internal/ui/render.go b/internal/ui/render.go index f716224..728b59d 100644 --- a/internal/ui/render.go +++ b/internal/ui/render.go @@ -296,20 +296,17 @@ func (m Model) renderTable() string { body = header + "\n" + emptyContent } } - - selectedStyle := lipgloss.NewStyle(). - Foreground(lipgloss.Color(m.skin.TableSelected.Foreground)). - Background(lipgloss.Color(m.skin.TableSelected.Background)) + // + //selectedStyle := lipgloss.NewStyle(). + // Foreground(lipgloss.Color(m.skin.TableSelected.Foreground)). + // Background(lipgloss.Color(m.skin.TableSelected.Background)) paddingStyle := lipgloss.NewStyle(). Background(lipgloss.Color(m.skin.Table.Background)) bodyLines := strings.Split(body, "\n") for i, line := range bodyLines { - selected := i > 0 && i-1 == m.table.Cursor() - if selected { - line = selectedStyle.Render(ansi.Strip(line)) - } else if i > 0 && strings.TrimSpace(ansi.Strip(line)) == "" { + if i > 0 && strings.TrimSpace(ansi.Strip(line)) == "" { line = paddingStyle.Render(strings.Repeat(" ", innerWidth)) } diff --git a/internal/ui/styles.go b/internal/ui/styles.go index 3c5d5c1..7b7f87d 100644 --- a/internal/ui/styles.go +++ b/internal/ui/styles.go @@ -4,6 +4,7 @@ import ( "github.com/akyriako/o7k/internal/config" "github.com/charmbracelet/bubbles/table" "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/x/ansi" ) //Header and AppView @@ -181,7 +182,8 @@ func tableStyles(skin config.Skin) table.Styles { styles.Selected = styles.Selected. Foreground(lipgloss.Color(skin.TableSelected.Foreground)). Background(lipgloss.Color(skin.TableSelected.Background)). - Bold(true) + Bold(true). + Transform(ansi.Strip) return styles }