(text, query string, r *lipgloss.Renderer)
| 131 | } |
| 132 | |
| 133 | func highlightMatch(text, query string, r *lipgloss.Renderer) string { |
| 134 | lowerText := strings.ToLower(text) |
| 135 | lowerQuery := strings.ToLower(query) |
| 136 | |
| 137 | idx := strings.Index(lowerText, lowerQuery) |
| 138 | if idx < 0 { |
| 139 | return text |
| 140 | } |
| 141 | |
| 142 | style := r.NewStyle().Foreground(lipgloss.Color("3")).Bold(true) // Yellow bold |
| 143 | before := text[:idx] |
| 144 | match := text[idx : idx+len(query)] |
| 145 | after := text[idx+len(query):] |
| 146 | |
| 147 | return before + style.Render(match) + after |
| 148 | } |
no outgoing calls