Skip to content

fix(list): convert fuzzy match indexes from byte to rune offsets#1014

Open
upuddu wants to merge 1 commit into
charmbracelet:mainfrom
upuddu:fix/list-filter-rune-indexes
Open

fix(list): convert fuzzy match indexes from byte to rune offsets#1014
upuddu wants to merge 1 commit into
charmbracelet:mainfrom
upuddu:fix/list-filter-rune-indexes

Conversation

@upuddu

@upuddu upuddu commented Jul 7, 2026

Copy link
Copy Markdown

sahilm/fuzzy reports MatchedIndexes as byte offsets, but MatchesForItem documents them as rune positions and lipgloss.StyleRunes consumes them as such - so filtering a list whose item titles contain multi-byte characters (CJK, accents, emoji) highlighted the wrong runes, or none. This converts the offsets from byte to rune positions in DefaultFilter and UnsortedFilter.

Fixes #124

sahilm/fuzzy reports MatchedIndexes as byte offsets, but MatchesForItem
documents them as rune positions and lipgloss.StyleRunes consumes them as
such. For targets containing multi-byte characters this highlighted the
wrong runes (or none). Convert the offsets in DefaultFilter and
UnsortedFilter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter underline seems to be off

1 participant