From 4fb2e3d14e856cb6917204ce824d89b3cdf8de9c Mon Sep 17 00:00:00 2001 From: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com> Date: Sat, 14 Jun 2025 16:33:48 +0800 Subject: [PATCH] Fix translation mapping logic --- Flow.Launcher.Infrastructure/PinyinAlphabet.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher.Infrastructure/PinyinAlphabet.cs b/Flow.Launcher.Infrastructure/PinyinAlphabet.cs index 6a2cd1e66..36f007f39 100644 --- a/Flow.Launcher.Infrastructure/PinyinAlphabet.cs +++ b/Flow.Launcher.Infrastructure/PinyinAlphabet.cs @@ -99,13 +99,19 @@ namespace Flow.Launcher.Infrastructure { if (content[i] >= 0x3400 && content[i] <= 0x9FD5) { - string dp = _settings.UseDoublePinyin ? ToDoublePin(resultList[i]) : resultList[i]; - map.AddNewIndex(i, resultBuilder.Length, dp.Length + 1); + string translated = _settings.UseDoublePinyin ? ToDoublePin(resultList[i]) : resultList[i]; if (previousIsChinese) { + map.AddNewIndex(i, resultBuilder.Length, translated.Length + 1); resultBuilder.Append(' '); + resultBuilder.Append(translated); + } + else + { + map.AddNewIndex(i, resultBuilder.Length, translated.Length); + resultBuilder.Append(translated); + previousIsChinese = true; } - resultBuilder.Append(dp); } else {