-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[JEWEL-1024] Improvements to SpeedSearchArea to support using for filter #3361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
9ed15c7 to
8857fc4
Compare
...jewel/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/lazy/SelectableLazyColumn.kt
Outdated
Show resolved
Hide resolved
...ewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/search/SpeedSearchableLazyColumn.kt
Show resolved
Hide resolved
8857fc4 to
dc7354c
Compare
- Fixed index emission on SelectableLazyColumn when the selection changes by the speed search - Created 'EmptySpeedSearchMatcher' to easily identify when the filter text is empty - This matches is automatically returned in the SpeedSearchState.matcher when the text is empty - Added 'dismissOnLoseFocus' to SpeedSearchArea to keep the filter when the focus is left from the component - Added 'currentMatcher' to the 'SpeedSearchState', allowing the user use it for filtering purposes - Created convenience function on top of 'SpeedSearchMatcher' to check if the given text matches or not - Created convenience functions to support filtering collections based on the speed search matcher
dc7354c to
f2d590a
Compare
wellingtoncosta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just small suggestions, LGTM overall.
| public fun `filter strings should return only exact matching items`() { | ||
| val items = listOf("apple", "pineapple", "application", "banana") | ||
| val matcher = SpeedSearchMatcher.exactSubstringMatcher("apple") | ||
| val result = items.filter(matcher) { it } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can use the Iterable<String>.filter() overload here to avoid this { it } block.
| public fun `filter strings should return empty list when no items match`() { | ||
| val items = listOf("apple", "banana", "cherry") | ||
| val matcher = SpeedSearchMatcher.exactSubstringMatcher("xyz") | ||
| val result = items.filter(matcher) { it } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
Evidences
Release notes
New features
Bug fixes
Note
Introduces filtering-focused improvements and small fixes around speed search and selection.
SpeedSearchState,rememberSpeedSearchState,dismissOnLoseFocusflag, andSpeedSearchState.currentMatcher+ visibility controls; internal batching/caching for better performance.EmptySpeedSearchMatcher,SpeedSearchMatcher.doesMatch, andIterable.filter(...)extensions (strings and generics).SpeedSearchableLazyColumnScrollEffectnow reports selection viaonSelectedIndexChange;SelectableLazyColumnemits indices when selection changes via SpeedSearch and syncslastActiveItemIndex.dismissOnLoseFocus=false.Written by Cursor Bugbot for commit 8857fc4. This will update automatically on new commits. Configure here.