feat(search): add unicode character removal for fuzzy matching#4360
feat(search): add unicode character removal for fuzzy matching#43604yinn wants to merge 18 commits intoFlow-Launcher:devfrom
Conversation
Introduced a string preprocessing step in FuzzySearch that removes unicode characters. This improves the search
experience by allowing users to find results regardless of accents or special formatting.
|
🥷 Code experts: Jack251970 Jack251970 has most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame: ✨ Comment |
|
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new SensitiveAccents setting and UI, implements an accent-normalization map and Normalize(string), and integrates accent-aware normalization into StringMatcher.FuzzyMatch to make fuzzy search optionally diacritic-sensitive. Changes
Sequence Diagram(s)mermaid User->>SettingsUI: Toggle SensitiveAccents Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
Flow.Launcher.Infrastructure/StringMatcher.cs (1)
66-73: Consider adding an option to toggle diacritics-insensitive matching.The linked issue
#4149specifically requests an option to enable/disable diacritics-insensitive matching, similar to the Everything app. The current implementation always removes accents with no way to opt out.If this is an intentional scope reduction, consider documenting it. Otherwise, you could add a setting flag:
if (_settings.IgnoreDiacritics) { query = RemoveAccents(query); stringToCompare = RemoveAccents(stringToCompare); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher.Infrastructure/StringMatcher.cs` around lines 66 - 73, FuzzyMatch currently always calls RemoveAccents on query and stringToCompare which forces diacritics-insensitive matching; add a configurable toggle (e.g. a boolean setting like _settings.IgnoreDiacritics) and only call RemoveAccents when that flag is true, updating FuzzyMatch's logic and any settings class to expose the option so consumers can enable/disable diacritics-insensitive matching; reference the RemoveAccents and FuzzyMatch methods and the MatchOption usage when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Flow.Launcher.Infrastructure/StringMatcher.cs`:
- Around line 249-250: In StringMatcher.cs (inside the method using
Char.GetUnicodeCategory), rename the local variable unicodedCategory to
unicodeCategory to fix the typo and consistency, and also replace the type alias
use from Char.GetUnicodeCategory(c) to char.GetUnicodeCategory(c) for C# keyword
consistency; update any subsequent references to the variable name
(unicodeCategory) accordingly.
- Around line 72-73: The matching indices are computed on the post-RemoveAccents
normalized string but applied to the original input, causing mismatches when
combining marks change string length; update the flow in the method that calls
RemoveAccents to 1) keep the original stringToCompare (save
originalStringToCompare before normalization), 2) produce an index mapping from
normalized-to-original positions when RemoveAccents transforms the string
(similar to the existing TranslationMapping for alphabet translation), and 3)
before returning, remap all indices in indexList and any positions inside
acronymMatchData using that accent-removal mapping (in addition to the existing
TranslationMapping) so returned indices align with the original string. Ensure
the mapping logic is used wherever indices are translated back (same spot where
TranslationMapping is applied).
---
Nitpick comments:
In `@Flow.Launcher.Infrastructure/StringMatcher.cs`:
- Around line 66-73: FuzzyMatch currently always calls RemoveAccents on query
and stringToCompare which forces diacritics-insensitive matching; add a
configurable toggle (e.g. a boolean setting like _settings.IgnoreDiacritics) and
only call RemoveAccents when that flag is true, updating FuzzyMatch's logic and
any settings class to expose the option so consumers can enable/disable
diacritics-insensitive matching; reference the RemoveAccents and FuzzyMatch
methods and the MatchOption usage when making the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0172967a-b14a-495a-9c63-e4cd5ee587ab
📒 Files selected for processing (1)
Flow.Launcher.Infrastructure/StringMatcher.cs
| query = RemoveAccents(query); | ||
| stringToCompare = RemoveAccents(stringToCompare); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for MatchData usage to understand the highlighting mechanism
rg -n -C3 'MatchData' --type=csRepository: Flow-Launcher/Flow.Launcher
Length of output: 12041
🏁 Script executed:
#!/bin/bash
# Find the context around indexList in StringMatcher.cs
rg -n 'indexList' Flow.Launcher.Infrastructure/StringMatcher.cs -B2 -A2Repository: Flow-Launcher/Flow.Launcher
Length of output: 1657
🏁 Script executed:
#!/bin/bash
# Find where MatchResult is constructed in StringMatcher.cs to see all return paths
rg -n 'new MatchResult\|return new' Flow.Launcher.Infrastructure/StringMatcher.cs -B1 -A1Repository: Flow-Launcher/Flow.Launcher
Length of output: 53
🏁 Script executed:
#!/bin/bash
# Get the full context of StringMatcher.cs around lines 60-90 to understand the flow
sed -n '60,90p' Flow.Launcher.Infrastructure/StringMatcher.cs | cat -nRepository: Flow-Launcher/Flow.Launcher
Length of output: 2168
🏁 Script executed:
#!/bin/bash
# Get context around line 79 where translationMapping is mentioned
sed -n '70,150p' Flow.Launcher.Infrastructure/StringMatcher.cs | cat -nRepository: Flow-Launcher/Flow.Launcher
Length of output: 4371
🏁 Script executed:
#!/bin/bash
# Check how FuzzyMatch is called and what string is highlighted
# Look at a specific plugin example
sed -n '100,110p' Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs | cat -nRepository: Flow-Launcher/Flow.Launcher
Length of output: 703
🏁 Script executed:
#!/bin/bash
# Check the Result model to understand how TitleHighlightData is used
rg -n 'TitleHighlightData' Flow.Launcher.Plugin/SharedModels/ -B2 -A2Repository: Flow-Launcher/Flow.Launcher
Length of output: 53
🏁 Script executed:
#!/bin/bash
# Search for where TitleHighlightData is actually applied (UI rendering)
rg -n 'TitleHighlightData' --type=cs | grep -v 'test\|Test' | head -20Repository: Flow-Launcher/Flow.Launcher
Length of output: 1514
🏁 Script executed:
#!/bin/bash
# Find RemoveAccents method implementation
rg -n 'private.*RemoveAccents|public.*RemoveAccents' Flow.Launcher.Infrastructure/StringMatcher.cs -A10Repository: Flow-Launcher/Flow.Launcher
Length of output: 566
🏁 Script executed:
#!/bin/bash
# Check test cases for accent handling
find . -name '*StringMatcher*Test*' -o -name '*Test*StringMatcher*' | head -5Repository: Flow-Launcher/Flow.Launcher
Length of output: 53
🏁 Script executed:
#!/bin/bash
# Search for test files
fd -e cs -p '*test*' | rg -i 'stringmatcher|fuzzymatch' | head -10Repository: Flow-Launcher/Flow.Launcher
Length of output: 356
🏁 Script executed:
#!/bin/bash
# Get the complete RemoveAccents method
sed -n '240,260p' Flow.Launcher.Infrastructure/StringMatcher.cs | cat -nRepository: Flow-Launcher/Flow.Launcher
Length of output: 1034
🏁 Script executed:
#!/bin/bash
# Search for test files properly
fd --glob '**/*Test*.cs' | rg -i 'stringmatcher|fuzzymatch'Repository: Flow-Launcher/Flow.Launcher
Length of output: 109
🏁 Script executed:
#!/bin/bash
# Also check if there are unit test files
find . -type f -name '*.cs' | xargs grep -l 'RemoveAccents\|FuzzyMatch' | grep -i testRepository: Flow-Launcher/Flow.Launcher
Length of output: 111
🏁 Script executed:
#!/bin/bash
# Check the test file for accent/diacritic test cases
rg -n 'RemoveAccents\|accent\|diacritic\|café\|é' Flow.Launcher.Test/FuzzyMatcherTest.cs -iRepository: Flow-Launcher/Flow.Launcher
Length of output: 53
🏁 Script executed:
#!/bin/bash
# Get the full FuzzyMatcherTest.cs to understand test coverage
wc -l Flow.Launcher.Test/FuzzyMatcherTest.csRepository: Flow-Launcher/Flow.Launcher
Length of output: 113
🏁 Script executed:
#!/bin/bash
# Look at the test file to see if accents are tested
sed -n '1,100p' Flow.Launcher.Test/FuzzyMatcherTest.cs | cat -nRepository: Flow-Launcher/Flow.Launcher
Length of output: 4471
🏁 Script executed:
#!/bin/bash
# Search through the entire test file for any accent or diacritic related tests
cat Flow.Launcher.Test/FuzzyMatcherTest.cs | grep -n -i 'accent\|diacritic\|café\|é\|ñ\|à\|ü' | head -20Repository: Flow-Launcher/Flow.Launcher
Length of output: 53
🏁 Script executed:
#!/bin/bash
# Let's check what's in the second half of the test file
sed -n '200,300p' Flow.Launcher.Test/FuzzyMatcherTest.cs | cat -nRepository: Flow-Launcher/Flow.Launcher
Length of output: 7418
🏁 Script executed:
#!/bin/bash
# Create a simple test to understand RemoveAccents behavior
python3 << 'EOF'
# Simulate C# NormalizationForm.FormD decomposition and accent removal
import unicodedata
test_strings = [
"café", # Regular accent
"naïve", # Diaeresis
"Zürich", # Umlaut
"São Paulo", # Tilde
"e̊", # e with combining ring
]
for s in test_strings:
# FormD = Decomposed
decomposed = unicodedata.normalize('NFD', s)
# Remove combining marks (NonSpacingMark category)
removed = ''.join(c for c in decomposed if unicodedata.category(c) != 'Mn')
# FormC = Composed (what the code does)
recomposed = unicodedata.normalize('NFC', removed)
print(f"Original: '{s}' (length: {len(s)})")
print(f"Decomposed: '{decomposed}' (length: {len(decomposed)})")
print(f"Accents removed: '{removed}' (length: {len(removed)})")
print(f"Recomposed: '{recomposed}' (length: {len(recomposed)})")
print(f"Match indices broken? {len(s) != len(recomposed)}")
print()
EOFRepository: Flow-Launcher/Flow.Launcher
Length of output: 916
Index mismatch when original string contains combining marks or is in decomposed form.
When RemoveAccents normalizes the string to FormD (decomposed), removes combining marks, then recomposes to FormC, the string length may change—particularly with combining marks like ring above (e̊) that decompose to multiple characters. The indices computed during matching are based on the post-RemoveAccents string, but are used to highlight the original input string. If the original string was in decomposed form or contains combining marks, the indices will be misaligned.
Unlike the translationMapping for alphabet translation (created after accent removal), there is no equivalent mapping to adjust indices from the normalized string back to the original. No test cases currently cover this scenario.
Consider:
- Storing the original
stringToComparebefore normalization - Creating an index mapping for accent removal changes (similar to
TranslationMapping) - Applying this mapping to both
indexListandacronymMatchDatabefore returning
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Flow.Launcher.Infrastructure/StringMatcher.cs` around lines 72 - 73, The
matching indices are computed on the post-RemoveAccents normalized string but
applied to the original input, causing mismatches when combining marks change
string length; update the flow in the method that calls RemoveAccents to 1) keep
the original stringToCompare (save originalStringToCompare before
normalization), 2) produce an index mapping from normalized-to-original
positions when RemoveAccents transforms the string (similar to the existing
TranslationMapping for alphabet translation), and 3) before returning, remap all
indices in indexList and any positions inside acronymMatchData using that
accent-removal mapping (in addition to the existing TranslationMapping) so
returned indices align with the original string. Ensure the mapping logic is
used wherever indices are translated back (same spot where TranslationMapping is
applied).
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
There was a problem hiding this comment.
@4yinn Do you think we need to handle this?
From my perspective as a Flow Launcher user, I think this feature is quite necessary. Many times when I search for programs that contain accents, such as “Câmera”, I tend to type the word without accents, like “camera”, because that’s how I usually type when searching in Windows.
Because of this, I often have difficulty finding applications in Flow when their names contain accents. The same issue was mentioned in the GitHub issue opened by another Brazilian user, which is why I decided to implement this improvement.
Sorry for the late response.
There was a problem hiding this comment.
@4yinn Do you think we need to handle this?
From my perspective as a Flow Launcher user, I think this feature is quite necessary. Many times when I search for programs that contain accents, such as “Câmera”, I tend to type the word without accents, like “camera”, because that’s how I usually type when searching in Windows.
Because of this, I often have difficulty finding applications in Flow when their names contain accents. The same issue was mentioned in the GitHub issue opened by another Brazilian user, which is why I decided to implement this improvement.
Sorry for the late response.
I'm sorry, it seems you misunderstood me. What I meant was that from AI's review, this removal may change the length of the string which can cause some issues like incorrect highlights.
There was a problem hiding this comment.
@4yinn Do you think we need to handle this?
From my perspective as a Flow Launcher user, I think this feature is quite necessary. Many times when I search for programs that contain accents, such as “Câmera”, I tend to type the word without accents, like “camera”, because that’s how I usually type when searching in Windows.
Because of this, I often have difficulty finding applications in Flow when their names contain accents. The same issue was mentioned in the GitHub issue opened by another Brazilian user, which is why I decided to implement this improvement.
Sorry for the late response.I'm sorry, it seems you misunderstood me. What I meant was that from AI's review, this removal may change the length of the string which can cause some issues like incorrect highlights.
Sorry for the late reply. hmm ok. Do u think this implementation isn’t necessary, or does it just need further optimization?
There was a problem hiding this comment.
@4yinn I'm not sure if this Removal will bring about any changes to the string. Since this kind of character does not exist in my language, you need to confirm this issue. If so, improvements are needed here, that is, we need to map the string back and handle the content related to highlighting.
There was a problem hiding this comment.
@4yinn I'm not sure if this Removal will bring about any changes to the string. Since this kind of character does not exist in my language, you need to confirm this issue. If so, improvements are needed here, that is, we need to map the string back and handle the content related to highlighting.
Yeah, my language is pretty boring when it comes to accents. Sorry for the late reply again — I was working. I’ll check this now and look for improvements.
There was a problem hiding this comment.
@4yinn I'm not sure if this Removal will bring about any changes to the string. Since this kind of character does not exist in my language, you need to confirm this issue. If so, improvements are needed here, that is, we need to map the string back and handle the content related to highlighting.
Yeah, my language is pretty boring when it comes to accents. Sorry for the late reply again — I was working. I’ll check this now and look for improvements.
Thanks for your reply!
There was a problem hiding this comment.
2 issues found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="Flow.Launcher.Infrastructure/StringMatcher.cs">
<violation number="1" location="Flow.Launcher.Infrastructure/StringMatcher.cs:72">
P1: `query` is not revalidated after accent stripping, so mark-only Unicode input can become empty and crash at `querySubstrings[0]`.</violation>
<violation number="2" location="Flow.Launcher.Infrastructure/StringMatcher.cs:73">
P2: Match indices are computed after accent-stripping but never mapped back to original string positions, causing incorrect highlight offsets for decomposed Unicode text.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Jack251970
left a comment
There was a problem hiding this comment.
Thanks for your contribution! But from AI's review, this removal may change the length of the string which can cause some issues like incorrect highlights.
|
Please don't involve too much code format changes so we can trace changes in the future. |
jjw24
left a comment
There was a problem hiding this comment.
Thank you for your PR.
StringMatcher is performance-critical, so we must minimize additional overhead. Please address the following:
-
Consolidate Loops: The current implementation performs an initial loop to identify and remove Unicode characters, followed by a second loop for the main matching logic. Please merge it into the main loop to avoid redundant iteration.
-
Conditional Unicode Processing: We should make Unicode removal optional—for instance, by adding a toggle for non-English languages. This prevents unnecessary processing when the feature isn't required.
Yes, I can see the problem. I'll think about a way to implement it with better optimizations. |
… option Implemented a string normalization method to handle accented characters, improving search consistency and preventing query mismatches. Added an accent mapping dictionary for common diacritics Implemented normalization using Span<char> and stackalloc to reduce heap allocations and improve performance Introduced a user-controlled toggle (SensitiveAccents) to enable or disable normalization dynamically Prepared the system for cache-aware queries based on normalization settings
…github.com/egotting/Flow.Launcher into feature/4149-diacritics-insensitive-search
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Flow.Launcher.Infrastructure/StringMatcher.cs (1)
27-31:⚠️ Potential issue | 🔴 CriticalNullReferenceException:
_settingsis null when using this constructor.The workaround constructor does not initialize
_settings, butFuzzyMatchunconditionally accesses_settings.SensitiveAccentson lines 92-93. This will throwNullReferenceExceptionfor all unit tests using this constructor.🐛 Proposed fix with null-conditional fallback
// This is a workaround to allow unit tests to set the instance public StringMatcher(IAlphabet alphabet) { _alphabet = alphabet; + _settings = null; // Explicitly null for tests - FuzzyMatch will use default behavior }And update the usage on lines 92-93:
-var fullStringToCompare = _settings.SensitiveAccents ? fullStringToCompareAndNormalize : fullStringToCompareWithoutCase; -var queryToCompare = _settings.SensitiveAccents ? queryWithoutCaseAndNormalize : queryWithoutCase; +var sensitiveAccents = _settings?.SensitiveAccents ?? false; +var fullStringToCompare = sensitiveAccents ? fullStringToCompareAndNormalize : fullStringToCompareWithoutCase; +var queryToCompare = sensitiveAccents ? queryWithoutCaseAndNormalize : queryWithoutCase;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher.Infrastructure/StringMatcher.cs` around lines 27 - 31, The workaround constructor StringMatcher(IAlphabet alphabet) leaves the field _settings null which causes FuzzyMatch to throw a NullReferenceException when accessing _settings.SensitiveAccents; fix by ensuring _settings is initialized or guarded: either initialize _settings to a sensible default inside the constructor (e.g., _settings = new MatchingSettings() or the default settings object used by the other ctor) or change FuzzyMatch to use a null-safe check like (_settings?.SensitiveAccents ?? <defaultBool>) and (_settings?.PreferDiacritics ?? <defaultBool>) where those flags are read; update the constructor or the FuzzyMatch usage accordingly (referencing the StringMatcher constructor, the _settings field, and the FuzzyMatch method).
🧹 Nitpick comments (5)
Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml (1)
94-101: Missing Margin causes inconsistent spacing.The new SettingsCard lacks a
Marginattribute. Other cards in this file useMargin="0 4 0 0"for tight grouping orMargin="0 14 0 0"for section breaks. Additionally, this card is missing aHeaderIconwhich most other cards have.Consider whether this setting should be grouped with other search-related settings (e.g., near
querySearchPrecisionorShouldUsePinyin) rather than between notification and window positioning settings.🎨 Proposed fix to add margin and icon
<ui:SettingsCard + Margin="0 14 0 0" Description="{DynamicResource sensitiveAccentToolTip}" Header="{DynamicResource sensitiveAccent}"> + <ui:SettingsCard.HeaderIcon> + <ui:FontIcon Glyph="" /> + </ui:SettingsCard.HeaderIcon> <ui:ToggleSwitch IsOn="{Binding Settings.SensitiveAccents}" OffContent="{DynamicResource disable}" OnContent="{DynamicResource enable}" /> </ui:SettingsCard>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml` around lines 94 - 101, The new SettingsCard for the SensitiveAccents toggle lacks the standard Margin and HeaderIcon used by other cards, causing inconsistent spacing and missing iconography; update the SettingsCard element (the one containing the ToggleSwitch bound to Settings.SensitiveAccents) to include a Margin attribute (use either "0 4 0 0" for tight grouping or "0 14 0 0" for a section break to match surrounding cards) and add the appropriate HeaderIcon attribute to match other cards, and consider relocating this SettingsCard near related search settings such as querySearchPrecision or ShouldUsePinyin if it logically groups with search-related options instead of being placed between notifications and window positioning.Flow.Launcher.Infrastructure/StringMatcher.cs (3)
257-267: Implementation is efficient but has a stack size assumption.Using
stackalloc char[value.Length]is performant for typical search queries. For extremely long strings, this could cause stack overflow, though this is unlikely in practice for search operations.If robustness is needed for arbitrary input lengths, consider a threshold:
Span<char> buffer = value.Length <= 256 ? stackalloc char[value.Length] : new char[value.Length];🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher.Infrastructure/StringMatcher.cs` around lines 257 - 267, The Normalize method uses stackalloc with value.Length which can overflow the stack for very long inputs; modify Normalize to allocate the temporary buffer on the stack only for small inputs (e.g., <= 256 chars) and fall back to a heap-allocated char[] for larger inputs, then copy/use that buffer when mapping characters from AccentMap and returning the new string; update references inside Normalize to treat the heap array as a Span<char> so the rest of the logic (char.ToLowerInvariant, AccentMap.TryGetValue, new string(...)) is unchanged.
5-7: Unused imports can be removed.
System.GlobalizationandSystem.Textdon't appear to be used in the current implementation. These may be leftover from a previous approach usingNormalizationForm.FormD.🧹 Proposed cleanup
using CommunityToolkit.Mvvm.DependencyInjection; using Flow.Launcher.Plugin.SharedModels; using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; -using System.Text; using Flow.Launcher.Infrastructure.UserSettings;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher.Infrastructure/StringMatcher.cs` around lines 5 - 7, Remove the unused using directives System.Globalization and System.Text from the top of StringMatcher.cs; locate the using block in the StringMatcher file (where System.Linq is present) and delete the two unused imports so only necessary namespaces remain, leaving System.Linq (and any other actually referenced namespaces) intact to avoid warnings and keep the file tidy.
246-256: AccentMap has limited language coverage.The map covers common Western European accents but misses characters from:
- Polish: ą→a, ę→e, ł→l, ń→n, ś→s, ź→z, ż→z
- Turkish: ğ→g, ş→s, ı→i
- Czech/Slovak: ř→r, š→s, ž→z, č→c, ě→e, ů→u
- Nordic: ø→o, æ→ae
- And others
This manual approach trades comprehensiveness for performance and avoids the index-mapping complexity of Unicode normalization (FormD). Consider documenting this limitation or expanding the map based on user feedback.
➕ Expanded AccentMap example
private static readonly Dictionary<char, char> AccentMap = new() { ['á'] = 'a', ['à'] = 'a', ['ã'] = 'a', ['â'] = 'a', ['ä'] = 'a', ['å'] = 'a', + ['ą'] = 'a', ['æ'] = 'a', ['é'] = 'e', ['è'] = 'e', ['ê'] = 'e', ['ë'] = 'e', + ['ę'] = 'e', ['ě'] = 'e', ['í'] = 'i', ['ì'] = 'i', ['î'] = 'i', ['ï'] = 'i', + ['ı'] = 'i', ['ó'] = 'o', ['ò'] = 'o', ['õ'] = 'o', ['ô'] = 'o', ['ö'] = 'o', + ['ø'] = 'o', ['ú'] = 'u', ['ù'] = 'u', ['û'] = 'u', ['ü'] = 'u', + ['ů'] = 'u', ['ç'] = 'c', + ['č'] = 'c', ['ñ'] = 'n', + ['ń'] = 'n', ['ý'] = 'y', ['ÿ'] = 'y', + ['ł'] = 'l', + ['ś'] = 's', ['š'] = 's', ['ş'] = 's', + ['ź'] = 'z', ['ż'] = 'z', ['ž'] = 'z', + ['ř'] = 'r', + ['ğ'] = 'g' };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher.Infrastructure/StringMatcher.cs` around lines 246 - 256, The AccentMap dictionary in StringMatcher (AccentMap) only covers a subset of Western European diacritics; update the AccentMap to include the missing language characters (Polish: ą, ę, ł, ń, ś, ź, ż; Turkish: ğ, ş, ı; Czech/Slovak: ř, š, ž, č, ě, ů; Nordic: ø, æ→map 'æ'→"ae" decision) or alternatively add a clear comment above the AccentMap field explaining its limited coverage and why Unicode FormD normalization was avoided; if expanding, ensure you add both lowercase and uppercase mappings where needed and keep the dictionary initialization in AccentMap consistent with existing style.Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs (1)
199-211: ViewModel property is unused — XAML binds directly to Settings.The XAML at line 98 binds to
{Binding Settings.SensitiveAccents}, bypassing this ViewModel property entirely. Either:
- Remove this unused property, or
- Update the XAML to bind to
{Binding SensitiveAccents}to use the ViewModel wrapperIf there's intent to add custom logic in the setter later (like
EnableDialogJumpdoes), keep the property and update the XAML binding.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs` around lines 199 - 211, The SensitiveAccents property on SettingsPaneGeneralViewModel is unused because the XAML binds directly to Settings.SensitiveAccents; either remove the SensitiveAccents property from SettingsPaneGeneralViewModel (and any references) or update the XAML binding at the control (currently {Binding Settings.SensitiveAccents}) to {Binding SensitiveAccents} so the ViewModel wrapper is used; if you intend to keep room for future setter logic (like EnableDialogJump) keep the property and change the XAML, otherwise delete the property to avoid dead code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Flow.Launcher.Infrastructure/StringMatcher.cs`:
- Around line 92-93: The boolean name _settings.SensitiveAccents is inverted vs
behavior: when true the code strips accents (accent-insensitive). Rename the
setting to a clear name like IgnoreAccents or AccentInsensitiveSearch (and
update its usages) or invert the logic where fullStringToCompare and
queryToCompare are selected; specifically update the Settings property, any
corresponding ViewModel property, related XAML binding keys, and localization
labels so the new name matches behavior, and replace references to
_settings.SensitiveAccents in StringMatcher (affecting fullStringToCompare and
queryToCompare) with the new property or inverted condition.
---
Outside diff comments:
In `@Flow.Launcher.Infrastructure/StringMatcher.cs`:
- Around line 27-31: The workaround constructor StringMatcher(IAlphabet
alphabet) leaves the field _settings null which causes FuzzyMatch to throw a
NullReferenceException when accessing _settings.SensitiveAccents; fix by
ensuring _settings is initialized or guarded: either initialize _settings to a
sensible default inside the constructor (e.g., _settings = new
MatchingSettings() or the default settings object used by the other ctor) or
change FuzzyMatch to use a null-safe check like (_settings?.SensitiveAccents ??
<defaultBool>) and (_settings?.PreferDiacritics ?? <defaultBool>) where those
flags are read; update the constructor or the FuzzyMatch usage accordingly
(referencing the StringMatcher constructor, the _settings field, and the
FuzzyMatch method).
---
Nitpick comments:
In `@Flow.Launcher.Infrastructure/StringMatcher.cs`:
- Around line 257-267: The Normalize method uses stackalloc with value.Length
which can overflow the stack for very long inputs; modify Normalize to allocate
the temporary buffer on the stack only for small inputs (e.g., <= 256 chars) and
fall back to a heap-allocated char[] for larger inputs, then copy/use that
buffer when mapping characters from AccentMap and returning the new string;
update references inside Normalize to treat the heap array as a Span<char> so
the rest of the logic (char.ToLowerInvariant, AccentMap.TryGetValue, new
string(...)) is unchanged.
- Around line 5-7: Remove the unused using directives System.Globalization and
System.Text from the top of StringMatcher.cs; locate the using block in the
StringMatcher file (where System.Linq is present) and delete the two unused
imports so only necessary namespaces remain, leaving System.Linq (and any other
actually referenced namespaces) intact to avoid warnings and keep the file tidy.
- Around line 246-256: The AccentMap dictionary in StringMatcher (AccentMap)
only covers a subset of Western European diacritics; update the AccentMap to
include the missing language characters (Polish: ą, ę, ł, ń, ś, ź, ż; Turkish:
ğ, ş, ı; Czech/Slovak: ř, š, ž, č, ě, ů; Nordic: ø, æ→map 'æ'→"ae" decision) or
alternatively add a clear comment above the AccentMap field explaining its
limited coverage and why Unicode FormD normalization was avoided; if expanding,
ensure you add both lowercase and uppercase mappings where needed and keep the
dictionary initialization in AccentMap consistent with existing style.
In `@Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs`:
- Around line 199-211: The SensitiveAccents property on
SettingsPaneGeneralViewModel is unused because the XAML binds directly to
Settings.SensitiveAccents; either remove the SensitiveAccents property from
SettingsPaneGeneralViewModel (and any references) or update the XAML binding at
the control (currently {Binding Settings.SensitiveAccents}) to {Binding
SensitiveAccents} so the ViewModel wrapper is used; if you intend to keep room
for future setter logic (like EnableDialogJump) keep the property and change the
XAML, otherwise delete the property to avoid dead code.
In `@Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml`:
- Around line 94-101: The new SettingsCard for the SensitiveAccents toggle lacks
the standard Margin and HeaderIcon used by other cards, causing inconsistent
spacing and missing iconography; update the SettingsCard element (the one
containing the ToggleSwitch bound to Settings.SensitiveAccents) to include a
Margin attribute (use either "0 4 0 0" for tight grouping or "0 14 0 0" for a
section break to match surrounding cards) and add the appropriate HeaderIcon
attribute to match other cards, and consider relocating this SettingsCard near
related search settings such as querySearchPrecision or ShouldUsePinyin if it
logically groups with search-related options instead of being placed between
notifications and window positioning.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f7968958-51cd-4ab8-b534-538cd66e811a
📒 Files selected for processing (6)
Flow.Launcher.Infrastructure/StringMatcher.csFlow.Launcher.Infrastructure/UserSettings/Settings.csFlow.Launcher/Languages/en.xamlFlow.Launcher/Languages/pt-br.xamlFlow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.csFlow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
✅ Files skipped from review due to trivial changes (2)
- Flow.Launcher/Languages/en.xaml
- Flow.Launcher/Languages/pt-br.xaml
|
Sorry for the delay — I’ve been thinking about ways to implement this and reached a possible solution, but I got a bit stuck in one situation and wanted to ask for your help if possible. I implemented this approach to handle the issue: private static readonly Dictionary<char, char> AccentMap = new()
{
['á'] = 'a', ['à'] = 'a', ['ã'] = 'a', ['â'] = 'a', ['ä'] = 'a', ['å'] = 'a',
['é'] = 'e', ['è'] = 'e', ['ê'] = 'e', ['ë'] = 'e',
['í'] = 'i', ['ì'] = 'i', ['î'] = 'i', ['ï'] = 'i',
['ó'] = 'o', ['ò'] = 'o', ['õ'] = 'o', ['ô'] = 'o', ['ö'] = 'o',
['ú'] = 'u', ['ù'] = 'u', ['û'] = 'u', ['ü'] = 'u',
['ç'] = 'c',
['ñ'] = 'n',
['ý'] = 'y', ['ÿ'] = 'y'
};
public static string Normalize(string value)
{
Span<char> buffer = stackalloc char[value.Length];
for (int i = 0; i < value.Length; i++)
{
var c = char.ToLowerInvariant(value[i]);
buffer[i] = AccentMap.TryGetValue(c, out var mapped) ? mapped : c;
}
return new string(buffer);
}And I’m using it like this inside method FuzzyMatch: var fullStringToCompareAndNormalize = opt.IgnoreCase ? Normalize(stringToCompare) : stringToCompare;
var queryWithoutCaseAndNormalize = opt.IgnoreCase ? Normalize(query) : query;
var fullStringToCompareWithoutCase = opt.IgnoreCase ? stringToCompare.ToLower() : stringToCompare;
var queryWithoutCase = opt.IgnoreCase ? query.ToLower() : query;
var fullStringToCompare = _settings.SensitiveAccents ? fullStringToCompareAndNormalize : fullStringToCompareWithoutCase;
var queryToCompare = _settings.SensitiveAccents ? queryWithoutCaseAndNormalize : queryWithoutCase;This logic is only triggered when the user enables the option via a button in the general settings. However, I realized that since the apps/results are cached in memory during queries, I would need to reset the cache whenever the user enables or disables this option so that the behavior updates correctly. I got a bit stuck on how to handle this situation properly and would appreciate any guidance on the best approach. |
Ensures the system restarts automatically when the Sensitive Accents option is enabled or disabled Improves user experience by making the restart action explicit
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Flow.Launcher/Languages/pt-br.xaml`:
- Line 117: The resource entry with x:Key="typingStartEn" contains an accidental
trailing space after the closing </system:String> tag; edit the XAML element for
typingStartEn to remove the trailing whitespace so the line ends exactly with
</system:String> with no extra space, preserving the existing text content
"Sempre Começar Digitando em Modo Inglês".
- Around line 124-128: Add the five missing resource keys (sensitiveAccent,
sensitiveAccentToolTip, sensitiveAccentRestartTitle,
sensitiveAccentRestartMessage, sensitiveAccentRestartButton) into each of the
listed language resource XAML files (the ones currently missing these keys) as
system:String x:Key entries; if you don't have translations yet, populate them
with English fallback text matching the intent in the pt-br example so WPF
DynamicResource lookups in SettingsPaneGeneral.xaml resolve and do not render
blank UI; ensure keys are spelled exactly as shown and placed in the same
resource dictionary structure as other language entries.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8cc778ed-764e-4122-b3b8-a8bff44783de
📒 Files selected for processing (4)
Flow.Launcher/Languages/en.xamlFlow.Launcher/Languages/pt-br.xamlFlow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.csFlow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
🚧 Files skipped from review as they are similar to previous changes (3)
- Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
- Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
- Flow.Launcher/Languages/en.xaml
Flow.Launcher/Languages/pt-br.xaml
Outdated
| <system:String x:Key="sensitiveAccent">Ativar a distinção de acentuação na consulta de programas.</system:String> | ||
| <system:String x:Key="sensitiveAccentToolTip">Quando esta opção for alterada, será necessária uma reinicialização. Quando ativada, você poderá encontrar programas que contêm caracteres acentuados com mais facilidade.</system:String> | ||
| <system:String x:Key="sensitiveAccentRestartTitle">Reinicialização Necessária</system:String> | ||
| <system:String x:Key="sensitiveAccentRestartMessage">Alterar a sensibilidade de acentos requer a reinicialização do Flow Launcher para surtir efeito.</system:String> | ||
| <system:String x:Key="sensitiveAccentRestartButton">Reiniciar Agora</system:String> |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Find language files missing the sensitiveAccent* keys
echo "=== Language files missing sensitiveAccent keys ==="
for file in $(fd -e xaml . Flow.Launcher/Languages/); do
missing=""
for key in sensitiveAccent sensitiveAccentToolTip sensitiveAccentRestartTitle sensitiveAccentRestartMessage sensitiveAccentRestartButton; do
if ! grep -q "x:Key=\"$key\"" "$file"; then
missing="$missing $key"
fi
done
if [ -n "$missing" ]; then
echo "$file: missing$missing"
fi
doneRepository: Flow-Launcher/Flow.Launcher
Length of output: 4324
Add sensitiveAccent keys to 25 other language files to prevent blank UI text.*
The five new keys (sensitiveAccent, sensitiveAccentToolTip, sensitiveAccentRestartTitle, sensitiveAccentRestartMessage, sensitiveAccentRestartButton) are missing from 25 language files. When WPF cannot resolve DynamicResource bindings in SettingsPaneGeneral.xaml, it renders blank text for those UI elements, creating a poor experience for users of those languages.
The missing files are: ar, cs, da, de, es, es-419, fr, he, it, ja, ko, nb, nb-NO, nl, pl, pt-pt, ru, sk, sr, sr-Cyrl-RS, tr, uk-UA, vi, zh-cn, zh-tw.
Add these keys to all language files—at minimum with English fallback text if translations are not yet available.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Flow.Launcher/Languages/pt-br.xaml` around lines 124 - 128, Add the five
missing resource keys (sensitiveAccent, sensitiveAccentToolTip,
sensitiveAccentRestartTitle, sensitiveAccentRestartMessage,
sensitiveAccentRestartButton) into each of the listed language resource XAML
files (the ones currently missing these keys) as system:String x:Key entries; if
you don't have translations yet, populate them with English fallback text
matching the intent in the pt-br example so WPF DynamicResource lookups in
SettingsPaneGeneral.xaml resolve and do not render blank UI; ensure keys are
spelled exactly as shown and placed in the same resource dictionary structure as
other language entries.
There was a problem hiding this comment.
4 issues found across 26 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="Flow.Launcher/Languages/it.xaml">
<violation number="1" location="Flow.Launcher/Languages/it.xaml:124">
P2: Non-English locale file edited directly; translations are managed via Crowdin, so manual changes to it.xaml are likely to be overwritten or drift from source strings.</violation>
</file>
<file name="Flow.Launcher/Languages/vi.xaml">
<violation number="1" location="Flow.Launcher/Languages/vi.xaml:124">
P3: Non‑English localization files should not be edited directly in PRs; these Vietnamese additions will be overwritten by the translation pipeline. Add new keys to en.xaml and let the translation workflow propagate them.</violation>
</file>
<file name="Flow.Launcher/Languages/de.xaml">
<violation number="1" location="Flow.Launcher/Languages/de.xaml:124">
P2: Non-English locale files should not be edited directly; translations are managed via the centralized pipeline, so these de.xaml additions risk being overwritten or diverging.</violation>
</file>
<file name="Flow.Launcher/Languages/es-419.xaml">
<violation number="1" location="Flow.Launcher/Languages/es-419.xaml:124">
P3: Non-English translation strings are being edited directly in es-419.xaml. README indicates localization updates should be done via Crowdin, so these manual edits risk being overwritten by translation syncs and should be added through the translation workflow (starting from en.xaml).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Flow.Launcher/Languages/ja.xaml`:
- Around line 124-125: The tooltip text for the keys sensitiveAccent and
sensitiveAccentToolTip contradicts the label: confirm the actual runtime
behavior of the accent setting (does enabling make searches accent-sensitive /
distinguish accents, or does it ignore/normalize accents) and then update
sensitiveAccentToolTip to match that behavior; if the feature is
accent-sensitive, change the tooltip to explain that enabling will cause
searches to distinguish accents (and may require restart), otherwise change it
to say enabling will ignore/normalize accents to make accented program names
easier to find (and note restart requirement).
In `@Flow.Launcher/Languages/pl.xaml`:
- Around line 124-125: The toggle label "sensitiveAccent" currently says it
"enables considering diacritics" which conflicts with the tooltip
"sensitiveAccentToolTip" that says enabling it makes accented programs easier to
find (implying diacritics are ignored). Update the label string for
x:Key="sensitiveAccent" so its semantics match the tooltip (e.g., change to
wording that indicates the toggle will ignore/normalize diacritics to make
accented program names easier to find, such as "Ignoruj znaki diakrytyczne
podczas wyszukiwania programów."). Ensure only the label text is changed (leave
sensitiveAccentToolTip as-is).
In `@Flow.Launcher/Languages/uk-UA.xaml`:
- Around line 124-125: The current Ukrainian strings for keys sensitiveAccent
and sensitiveAccentToolTip are inverted vs. the behavior in code
(SensitiveAccents toggles Normalize() which makes matching accent‑insensitive);
update the text for the resource keys sensitiveAccent and sensitiveAccentToolTip
to state that enabling the option makes searches ignore/normalize diacritics (so
you can find programs regardless of accents) and that disabling it requires
exact diacritic matches, referencing the SensitiveAccents setting and the
Normalize() behavior for clarity.
In `@Flow.Launcher/Languages/vi.xaml`:
- Around line 124-125: The label and tooltip for the accent setting are
inconsistent with each other and must match the actual behavior of
Settings.SensitiveAccents; update the resources identified by sensitiveAccent
and sensitiveAccentToolTip so both describe the same effect (either
“accent-sensitive: enabling requires exact accented characters” or
“accent-insensitive: enabling makes accented and unaccented matches easier”),
and ensure the tooltip mentions that a restart is required and references
Settings.SensitiveAccents behavior for clarity.
In `@Flow.Launcher/Languages/zh-cn.xaml`:
- Around line 124-125: The zh-CN text for sensitiveAccent and
sensitiveAccentToolTip is ambiguous and uses inconsistent pronouns; update the
resource strings with clear wording that indicates the toggle’s behavior (e.g.,
whether accent marks are ignored or matched strictly) and make the pronoun
consistent with surrounding strings by using “您”; specifically, replace the
value of the system:String with x:Key="sensitiveAccent" to explicitly state the
mode (for example “在搜索时忽略重音符号” or “在搜索时区分重音符号” depending on actual behavior) and
update x:Key="sensitiveAccentToolTip" to an explanatory sentence using “您” that
notes the setting requires a restart and describes the benefit (e.g.,
“更改此选项后需要重启。启用后,搜索将忽略/区分重音符号,使您更容易找到包含或区分重音的程序。”) so users are not confused
about the toggle semantics.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1f445527-1bfd-4034-8a5b-8f19f1adf2a1
📒 Files selected for processing (26)
Flow.Launcher/Languages/ar.xamlFlow.Launcher/Languages/cs.xamlFlow.Launcher/Languages/da.xamlFlow.Launcher/Languages/de.xamlFlow.Launcher/Languages/es-419.xamlFlow.Launcher/Languages/es.xamlFlow.Launcher/Languages/fr.xamlFlow.Launcher/Languages/he.xamlFlow.Launcher/Languages/it.xamlFlow.Launcher/Languages/ja.xamlFlow.Launcher/Languages/ko.xamlFlow.Launcher/Languages/nb-NO.xamlFlow.Launcher/Languages/nb.xamlFlow.Launcher/Languages/nl.xamlFlow.Launcher/Languages/pl.xamlFlow.Launcher/Languages/pt-br.xamlFlow.Launcher/Languages/pt-pt.xamlFlow.Launcher/Languages/ru.xamlFlow.Launcher/Languages/sk.xamlFlow.Launcher/Languages/sr-Cyrl-RS.xamlFlow.Launcher/Languages/sr.xamlFlow.Launcher/Languages/tr.xamlFlow.Launcher/Languages/uk-UA.xamlFlow.Launcher/Languages/vi.xamlFlow.Launcher/Languages/zh-cn.xamlFlow.Launcher/Languages/zh-tw.xaml
✅ Files skipped from review due to trivial changes (21)
- Flow.Launcher/Languages/it.xaml
- Flow.Launcher/Languages/ar.xaml
- Flow.Launcher/Languages/ko.xaml
- Flow.Launcher/Languages/da.xaml
- Flow.Launcher/Languages/zh-tw.xaml
- Flow.Launcher/Languages/nb-NO.xaml
- Flow.Launcher/Languages/ru.xaml
- Flow.Launcher/Languages/tr.xaml
- Flow.Launcher/Languages/de.xaml
- Flow.Launcher/Languages/sr.xaml
- Flow.Launcher/Languages/cs.xaml
- Flow.Launcher/Languages/fr.xaml
- Flow.Launcher/Languages/es.xaml
- Flow.Launcher/Languages/nl.xaml
- Flow.Launcher/Languages/sr-Cyrl-RS.xaml
- Flow.Launcher/Languages/he.xaml
- Flow.Launcher/Languages/sk.xaml
- Flow.Launcher/Languages/pt-br.xaml
- Flow.Launcher/Languages/es-419.xaml
- Flow.Launcher/Languages/nb.xaml
- Flow.Launcher/Languages/pt-pt.xaml
Flow.Launcher/Languages/ja.xaml
Outdated
| <system:String x:Key="sensitiveAccent">プログラム検索時にアクセントを区別する。</system:String> | ||
| <system:String x:Key="sensitiveAccentToolTip">このオプションを変更した後は再起動が必要です。有効にすると、アクセント記号を含むプログラムをより簡単に見つけることができるようになります。</system:String> |
There was a problem hiding this comment.
Tooltip meaning conflicts with the setting label
Line 124 says accents are distinguished, but Line 125 implies enabling improves finding accented names (typically expected when accents are ignored). Please align wording with actual runtime behavior to avoid user confusion.
💬 Suggested wording update (if accent-sensitive is the intended behavior)
- <system:String x:Key="sensitiveAccentToolTip">このオプションを変更した後は再起動が必要です。有効にすると、アクセント記号を含むプログラムをより簡単に見つけることができるようになります。</system:String>
+ <system:String x:Key="sensitiveAccentToolTip">このオプションを変更した後は再起動が必要です。有効にすると、検索時にアクセント記号を区別します(例: camera と câmera は別扱い)。</system:String>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <system:String x:Key="sensitiveAccent">プログラム検索時にアクセントを区別する。</system:String> | |
| <system:String x:Key="sensitiveAccentToolTip">このオプションを変更した後は再起動が必要です。有効にすると、アクセント記号を含むプログラムをより簡単に見つけることができるようになります。</system:String> | |
| <system:String x:Key="sensitiveAccent">プログラム検索時にアクセントを区別する。</system:String> | |
| <system:String x:Key="sensitiveAccentToolTip">このオプションを変更した後は再起動が必要です。有効にすると、検索時にアクセント記号を区別します(例: camera と câmera は別扱い)。</system:String> |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Flow.Launcher/Languages/ja.xaml` around lines 124 - 125, The tooltip text for
the keys sensitiveAccent and sensitiveAccentToolTip contradicts the label:
confirm the actual runtime behavior of the accent setting (does enabling make
searches accent-sensitive / distinguish accents, or does it ignore/normalize
accents) and then update sensitiveAccentToolTip to match that behavior; if the
feature is accent-sensitive, change the tooltip to explain that enabling will
cause searches to distinguish accents (and may require restart), otherwise
change it to say enabling will ignore/normalize accents to make accented program
names easier to find (and note restart requirement).
Flow.Launcher/Languages/pl.xaml
Outdated
| <system:String x:Key="sensitiveAccent">Włącz uwzględnianie znaków diakrytycznych podczas wyszukiwania programów.</system:String> | ||
| <system:String x:Key="sensitiveAccentToolTip">Po zmianie tej opcji wymagany jest restart. Gdy jest włączona, łatwiej będzie znaleźć programy zawierające znaki akcentowane.</system:String> |
There was a problem hiding this comment.
Align toggle label semantics with tooltip intent.
Line 124 says the option enables considering diacritics (accent-sensitive), while Line 125 says enabling it makes accented programs easier to find (accent-insensitive). This can invert user expectation.
✍️ Proposed wording update
- <system:String x:Key="sensitiveAccent">Włącz uwzględnianie znaków diakrytycznych podczas wyszukiwania programów.</system:String>
- <system:String x:Key="sensitiveAccentToolTip">Po zmianie tej opcji wymagany jest restart. Gdy jest włączona, łatwiej będzie znaleźć programy zawierające znaki akcentowane.</system:String>
+ <system:String x:Key="sensitiveAccent">Ignoruj znaki diakrytyczne podczas wyszukiwania programów.</system:String>
+ <system:String x:Key="sensitiveAccentToolTip">Po zmianie tej opcji wymagany jest restart. Gdy ta opcja jest włączona, łatwiej znajdziesz programy zawierające znaki diakrytyczne.</system:String>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <system:String x:Key="sensitiveAccent">Włącz uwzględnianie znaków diakrytycznych podczas wyszukiwania programów.</system:String> | |
| <system:String x:Key="sensitiveAccentToolTip">Po zmianie tej opcji wymagany jest restart. Gdy jest włączona, łatwiej będzie znaleźć programy zawierające znaki akcentowane.</system:String> | |
| <system:String x:Key="sensitiveAccent">Ignoruj znaki diakrytyczne podczas wyszukiwania programów.</system:String> | |
| <system:String x:Key="sensitiveAccentToolTip">Po zmianie tej opcji wymagany jest restart. Gdy ta opcja jest włączona, łatwiej znajdziesz programy zawierające znaki diakrytyczne.</system:String> |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Flow.Launcher/Languages/pl.xaml` around lines 124 - 125, The toggle label
"sensitiveAccent" currently says it "enables considering diacritics" which
conflicts with the tooltip "sensitiveAccentToolTip" that says enabling it makes
accented programs easier to find (implying diacritics are ignored). Update the
label string for x:Key="sensitiveAccent" so its semantics match the tooltip
(e.g., change to wording that indicates the toggle will ignore/normalize
diacritics to make accented program names easier to find, such as "Ignoruj znaki
diakrytyczne podczas wyszukiwania programów."). Ensure only the label text is
changed (leave sensitiveAccentToolTip as-is).
Flow.Launcher/Languages/vi.xaml
Outdated
| <system:String x:Key="sensitiveAccent">Bật độ nhạy dấu khi tìm kiếm chương trình.</system:String> | ||
| <system:String x:Key="sensitiveAccentToolTip">Khi tùy chọn này được thay đổi, cần phải khởi động lại. Khi được bật, bạn sẽ có thể tìm thấy các chương trình có chứa các ký tự có dấu dễ dàng hơn.</system:String> |
There was a problem hiding this comment.
sensitiveAccent label and tooltip describe opposite behaviors
Line 124 says “enable accent sensitivity”, while Line 125 says enabling makes accented names easier to find (accent-insensitive behavior). This can invert user expectation for the toggle. Please align both strings to the same behavior as implemented by Settings.SensitiveAccents.
Suggested wording (if toggle means “accent-sensitive”)
- <system:String x:Key="sensitiveAccent">Bật độ nhạy dấu khi tìm kiếm chương trình.</system:String>
- <system:String x:Key="sensitiveAccentToolTip">Khi tùy chọn này được thay đổi, cần phải khởi động lại. Khi được bật, bạn sẽ có thể tìm thấy các chương trình có chứa các ký tự có dấu dễ dàng hơn.</system:String>
+ <system:String x:Key="sensitiveAccent">Phân biệt dấu khi tìm kiếm chương trình</system:String>
+ <system:String x:Key="sensitiveAccentToolTip">Khi thay đổi tùy chọn này, cần khởi động lại. Khi bật, tìm kiếm sẽ phân biệt dấu (ví dụ: "camera" và "câmera" là khác nhau).</system:String>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <system:String x:Key="sensitiveAccent">Bật độ nhạy dấu khi tìm kiếm chương trình.</system:String> | |
| <system:String x:Key="sensitiveAccentToolTip">Khi tùy chọn này được thay đổi, cần phải khởi động lại. Khi được bật, bạn sẽ có thể tìm thấy các chương trình có chứa các ký tự có dấu dễ dàng hơn.</system:String> | |
| <system:String x:Key="sensitiveAccent">Phân biệt dấu khi tìm kiếm chương trình</system:String> | |
| <system:String x:Key="sensitiveAccentToolTip">Khi thay đổi tùy chọn này, cần khởi động lại. Khi bật, tìm kiếm sẽ phân biệt dấu (ví dụ: "camera" và "câmera" là khác nhau).</system:String> |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Flow.Launcher/Languages/vi.xaml` around lines 124 - 125, The label and
tooltip for the accent setting are inconsistent with each other and must match
the actual behavior of Settings.SensitiveAccents; update the resources
identified by sensitiveAccent and sensitiveAccentToolTip so both describe the
same effect (either “accent-sensitive: enabling requires exact accented
characters” or “accent-insensitive: enabling makes accented and unaccented
matches easier”), and ensure the tooltip mentions that a restart is required and
references Settings.SensitiveAccents behavior for clarity.
Flow.Launcher/Languages/zh-cn.xaml
Outdated
| <system:String x:Key="sensitiveAccent">搜索程序时启用重音敏感度。</system:String> | ||
| <system:String x:Key="sensitiveAccentToolTip">更改此选项后需要重启。启用后,你将能更轻松地找到包含重音符号字符的程序。</system:String> |
There was a problem hiding this comment.
Clarify zh-CN wording to avoid toggle meaning confusion
Line 124 says “启用重音敏感度”, but Line 125 describes a benefit aligned with easier accent-agnostic matching. This can confuse users about whether accents are treated strictly or ignored. Also, Line 125 uses “你” while surrounding strings mostly use “您”.
✍️ Suggested wording update
- <system:String x:Key="sensitiveAccent">搜索程序时启用重音敏感度。</system:String>
- <system:String x:Key="sensitiveAccentToolTip">更改此选项后需要重启。启用后,你将能更轻松地找到包含重音符号字符的程序。</system:String>
+ <system:String x:Key="sensitiveAccent">搜索程序时忽略重音符号</system:String>
+ <system:String x:Key="sensitiveAccentToolTip">更改此选项后需要重启。启用后,您将更轻松地找到包含重音符号字符的程序(例如 camera 匹配 câmera)。</system:String>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <system:String x:Key="sensitiveAccent">搜索程序时启用重音敏感度。</system:String> | |
| <system:String x:Key="sensitiveAccentToolTip">更改此选项后需要重启。启用后,你将能更轻松地找到包含重音符号字符的程序。</system:String> | |
| <system:String x:Key="sensitiveAccent">搜索程序时忽略重音符号</system:String> | |
| <system:String x:Key="sensitiveAccentToolTip">更改此选项后需要重启。启用后,您将更轻松地找到包含重音符号字符的程序(例如 camera 匹配 câmera)。</system:String> |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Flow.Launcher/Languages/zh-cn.xaml` around lines 124 - 125, The zh-CN text
for sensitiveAccent and sensitiveAccentToolTip is ambiguous and uses
inconsistent pronouns; update the resource strings with clear wording that
indicates the toggle’s behavior (e.g., whether accent marks are ignored or
matched strictly) and make the pronoun consistent with surrounding strings by
using “您”; specifically, replace the value of the system:String with
x:Key="sensitiveAccent" to explicitly state the mode (for example “在搜索时忽略重音符号”
or “在搜索时区分重音符号” depending on actual behavior) and update
x:Key="sensitiveAccentToolTip" to an explanatory sentence using “您” that notes
the setting requires a restart and describes the benefit (e.g.,
“更改此选项后需要重启。启用后,搜索将忽略/区分重音符号,使您更容易找到包含或区分重音的程序。”) so users are not confused
about the toggle semantics.
VictoriousRaptor
left a comment
There was a problem hiding this comment.
Please remove all translations changes. Translation is done on crowdin after merging this PR.
| return new MatchResult(false, UserSettingSearchPrecision); | ||
| } | ||
|
|
||
| private static string RemoveAccents(string value) |
There was a problem hiding this comment.
If this functions changes the length of query we should use TranslationMapping to avoid highlight mismatches.
Jack251970
left a comment
There was a problem hiding this comment.
Could you please resolve the build issue first?
There was a problem hiding this comment.
2 issues found across 32 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml">
<violation number="1" location="Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml:95">
P3: DynamicResource key includes an unexpected space (`ignoreAccents ToolTip`), which likely does not match any defined resource key and will leave the description unresolved at runtime.</violation>
</file>
<file name="Flow.Launcher/Languages/da.xaml">
<violation number="1">
P2: Danish localization removed the old accent-sensitivity strings but the new ignoreAccents resources referenced by SettingsPaneGeneral.xaml are missing from da.xaml, leaving the new setting/restart InfoBar without localized strings.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…tcher" This reverts commit a52a6af.
Enhance search reliability and performance by refining the Normalize method. - Added null/empty string handling to prevent NullReferenceExceptions during search.
Description
Added a preprocessing step to
FuzzySearchto normalize Unicode characters and remove diacritics before matching.This allows searches to be accent-insensitive, improving usability. For example, searching for
camerawill also matchcâmera.Related Issue
Closes #4149
Summary by cubic
Adds accent-insensitive fuzzy matching behind a toggle to improve results for queries with diacritics. Adds a General Settings switch and restart prompt to control normalization (relates to #4149).
StringMatcher.FuzzyMatchnow compares normalized strings whenopt.IgnoreCaseandSettings.IgnoreAccentsare true; constructor acceptsSettings; normalization flows into substring splitting, space tracking, and acronym checks; index translation logic unchanged.Settings.IgnoreAccents; General Settings toggle withInfoBarand restart viaIPublicAPI.RestartApp; view model propertiesIgnoreAccentsandIgnoreAccentsRestartRequiredplusRestartAppcommand; fastNormalize(string)using a static accent map,stackalloc, andArrayPool<char>; null/empty guards.stackalloc, large inputs rent/return buffers viaArrayPool<char>; no new long‑lived allocations.SettingsintoStringMatcher; no new tests added.Written for commit 54a458d. Summary will update on new commits.