Skip to content

Commit

Permalink
[feat] change the color of the selection when filter focused
Browse files Browse the repository at this point in the history
  • Loading branch information
robinovitch61 committed Oct 1, 2024
1 parent b24710c commit fcef575
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/filterable_viewport/filterable_viewport.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ func (p FilterableViewport[T]) Update(msg tea.Msg) (FilterableViewport[T], tea.C

if p.Filter.Focused() {
if key.Matches(msg, p.keyMap.Enter) {
// done editing, apply Filter
// done editing
p.viewport.SelectedContentStyle = style.Inverse
p.Filter.Blur()
p.Filter.UpdateLabelAndSuffix()
}
Expand Down Expand Up @@ -105,6 +106,9 @@ func (p FilterableViewport[T]) Update(msg tea.Msg) (FilterableViewport[T], tea.C
if prevIsRegex != newIsRegex {
p.updateVisibleRows()
}

// change the color of the selection
p.viewport.SelectedContentStyle = style.AltInverse
return p, textinput.Blink
}

Expand Down Expand Up @@ -253,7 +257,7 @@ func (p *FilterableViewport[T]) updateVisibleRows() {
func (p *FilterableViewport[T]) clearFilter() {
p.Filter.BlurAndClear()
p.viewport.SetStringToHighlight("")
p.Filter.Blur()
p.viewport.SelectedContentStyle = style.Inverse
p.updateVisibleRows()
}

Expand Down

0 comments on commit fcef575

Please sign in to comment.