Skip to content

Commit 99b9344

Browse files
committed
fix: Trim search query to avoid spaces clearing out the config screen
1 parent 62f83cf commit 99b9344

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

common/src/main/java/net/blay09/mods/balm/client/platform/config/screen/BalmConfigScreenSearch.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ public static boolean categoryMatches(ConfigCategory category, String query) {
3131
}
3232

3333
public static List<BalmConfigScreenSection> filterSections(List<BalmConfigScreenSection> sections, String query, BalmConfigScreenContext context) {
34+
final var normalizedQuery = query.trim();
3435
final var filteredSections = new ArrayList<BalmConfigScreenSection>();
3536
for (final var section : sections) {
36-
final var sectionMatches = componentMatches(section.title(), query);
37+
final var sectionMatches = componentMatches(section.title(), normalizedQuery);
3738
final var matchingRows = section.rows().stream()
3839
.filter(row -> row.isVisible(context))
39-
.filter(row -> sectionMatches || row.matchesFilter(query))
40+
.filter(row -> sectionMatches || row.matchesFilter(normalizedQuery))
4041
.toList();
4142
if (!matchingRows.isEmpty()) {
4243
filteredSections.add(new BalmConfigScreenSection(section.title(), matchingRows));

0 commit comments

Comments
 (0)