Skip to content

Commit

Permalink
Fix styling of footer when using base style with filter input (#120)
Browse files Browse the repository at this point in the history
* Fix styling of footer when using base style with filter input

* More efficient and safer style application
  • Loading branch information
Evertras authored Jul 9, 2022
1 parent a3b97a9 commit 0cb072a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion table/footer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ func (m Model) renderFooter(width int, includeTop bool) string {

// paged feature enabled
if m.pageSize != 0 {
sections = append(sections, fmt.Sprintf("%d/%d", m.CurrentPage(), m.MaxPages()))
str := fmt.Sprintf("%d/%d", m.CurrentPage(), m.MaxPages())
if m.filtered && m.filterTextInput.Focused() {
// Need to apply inline style here in case of filter input cursor, because
// the input cursor resets the style after rendering. Note that Inline(true)
// creates a copy, so it's safe to use here without mutating the underlying
// base style.
str = m.baseStyle.Inline(true).Render(str)
}
sections = append(sections, str)
}

footerText := strings.Join(sections, " ")
Expand Down

0 comments on commit 0cb072a

Please sign in to comment.