mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
make map variable more clear + formatting
This commit is contained in:
parent
81733d35a6
commit
74f1b05257
2 changed files with 5 additions and 8 deletions
|
|
@ -45,7 +45,6 @@ namespace Flow.Launcher.Infrastructure
|
|||
|
||||
int count = 0;
|
||||
|
||||
|
||||
// Corner case handle
|
||||
if (translatedIndex < translatedIndexs[0])
|
||||
return translatedIndex;
|
||||
|
|
@ -113,7 +112,6 @@ namespace Flow.Launcher.Infrastructure
|
|||
private ConcurrentDictionary<string, (string translation, TranslationMapping map)> _pinyinCache =
|
||||
new ConcurrentDictionary<string, (string translation, TranslationMapping map)>();
|
||||
|
||||
|
||||
private Settings _settings;
|
||||
|
||||
public void Initialize([NotNull] Settings settings)
|
||||
|
|
|
|||
|
|
@ -47,17 +47,17 @@ namespace Flow.Launcher.Infrastructure
|
|||
return new MatchResult(false, UserSettingSearchPrecision);
|
||||
|
||||
query = query.Trim();
|
||||
TranslationMapping map;
|
||||
(stringToCompare, map) = _alphabet?.Translate(stringToCompare) ?? (stringToCompare, null);
|
||||
TranslationMapping translationMapping;
|
||||
(stringToCompare, translationMapping) = _alphabet?.Translate(stringToCompare) ?? (stringToCompare, null);
|
||||
|
||||
var currentAcronymQueryIndex = 0;
|
||||
var acronymMatchData = new List<int>();
|
||||
var queryWithoutCase = opt.IgnoreCase ? query.ToLower() : query;
|
||||
|
||||
// preset acronymScore
|
||||
int acronymScore = 100;
|
||||
|
||||
var fullStringToCompareWithoutCase = opt.IgnoreCase ? stringToCompare.ToLower() : stringToCompare;
|
||||
var queryWithoutCase = opt.IgnoreCase ? query.ToLower() : query;
|
||||
|
||||
var querySubstrings = queryWithoutCase.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
|
||||
int currentQuerySubstringIndex = 0;
|
||||
|
|
@ -136,7 +136,6 @@ namespace Flow.Launcher.Infrastructure
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (firstMatchIndex < 0)
|
||||
{
|
||||
// first matched char will become the start of the compared string
|
||||
|
|
@ -197,7 +196,7 @@ namespace Flow.Launcher.Infrastructure
|
|||
// return acronym Match if possible
|
||||
if (acronymMatchData.Count == query.Length && acronymScore >= (int) UserSettingSearchPrecision)
|
||||
{
|
||||
acronymMatchData = acronymMatchData.Select(x => map?.MapToOriginalIndex(x) ?? x).Distinct().ToList();
|
||||
acronymMatchData = acronymMatchData.Select(x => translationMapping?.MapToOriginalIndex(x) ?? x).Distinct().ToList();
|
||||
return new MatchResult(true, UserSettingSearchPrecision, acronymMatchData, acronymScore);
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +207,7 @@ namespace Flow.Launcher.Infrastructure
|
|||
var score = CalculateSearchScore(query, stringToCompare, firstMatchIndex - nearestSpaceIndex - 1,
|
||||
lastMatchIndex - firstMatchIndex, allSubstringsContainedInCompareString);
|
||||
|
||||
var resultList = indexList.Select(x => map?.MapToOriginalIndex(x) ?? x).Distinct().ToList();
|
||||
var resultList = indexList.Select(x => translationMapping?.MapToOriginalIndex(x) ?? x).Distinct().ToList();
|
||||
return new MatchResult(true, UserSettingSearchPrecision, resultList, score);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue