From b2ddd6acee1b65136eeb8e9f34a3699184ef3029 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Aug 2026 07:13:52 +0000 Subject: [PATCH 1/2] Initial plan From 7dea4708dac37b3a4b8a6d44a6ba69fd0ea8d61e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Aug 2026 07:25:19 +0000 Subject: [PATCH 2/2] Fix incorrect pinyin highlight: use GetAllPinyin per character instead of bulk GetPinyinList MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ToolGood library's GetPinyinList() performs context-sensitive disambiguation that can produce incorrect pinyin for some characters. For example, '查' in '核查' was incorrectly returned as 'Zha' instead of 'Cha', causing both full-pinyin ("hecha") and double-pinyin ("heia" in XiaoHe) searches to fail to highlight the matched characters. Fix: Use WordsHelper.GetAllPinyin() per character, which returns pronunciations sorted by frequency (most common first), avoiding incorrect context-sensitive disambiguation. Co-authored-by: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com> --- Flow.Launcher.Infrastructure/PinyinAlphabet.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher.Infrastructure/PinyinAlphabet.cs b/Flow.Launcher.Infrastructure/PinyinAlphabet.cs index 7f55d890992..212e274ba83 100644 --- a/Flow.Launcher.Infrastructure/PinyinAlphabet.cs +++ b/Flow.Launcher.Infrastructure/PinyinAlphabet.cs @@ -117,17 +117,20 @@ public bool ShouldTranslate(string stringToTranslate) private (string translation, TranslationMapping map) BuildCacheFromContent(string content) { - var resultList = WordsHelper.GetPinyinList(content); var resultBuilder = new StringBuilder(_settings.UseDoublePinyin ? 3 : 4); // Pre-allocate with estimated capacity var map = new TranslationMapping(); var previousIsChinese = false; - for (var i = 0; i < resultList.Length; i++) + for (var i = 0; i < content.Length; i++) { if (IsChineseCharacter(content[i])) { - var translated = _settings.UseDoublePinyin ? ToDoublePinyin(resultList[i]) : resultList[i]; + // Use GetAllPinyin per character to avoid incorrect context-sensitive pinyin disambiguation. + // For example, GetPinyinList("核查") returns ["He","Zha"] but '查' should be "Cha" here. + var allPinyins = WordsHelper.GetAllPinyin(content[i], false); + var pinyin = allPinyins.Count > 0 ? allPinyins[0] : WordsHelper.GetPinyinList(content[i].ToString(), false)[0]; + var translated = _settings.UseDoublePinyin ? ToDoublePinyin(pinyin) : pinyin; if (i > 0 && content[i - 1] != ' ') {