From f50bfb4e4a690e1a55644aab586fee1e69b09443 Mon Sep 17 00:00:00 2001 From: fanlusky <1730976608@qq.com> Date: Tue, 21 Jul 2026 13:17:06 +0800 Subject: [PATCH] Fix the issue where preedit is not handled during word creation in TSF preedit pinyin mode. --- server/src/ipc/event_listener.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/ipc/event_listener.cpp b/server/src/ipc/event_listener.cpp index 67c5668b..326e2228 100644 --- a/server/src/ipc/event_listener.cpp +++ b/server/src/ipc/event_listener.cpp @@ -276,7 +276,13 @@ std::string CandidateTextForOutput(const std::string &text) std::wstring BuildCreateWordPipePayload(const std::string &remaining_raw_input_with_cases, const std::string ¤t_word) { - return string_to_wstring(remaining_raw_input_with_cases + "\t" + CandidateTextForOutput(current_word)); + // remaining_raw \t committed_word \t display_preedit + // display_preedit matches the candidate-window preedit (汉字 + 剩余分词). + // Legacy TSF only reads the first two fields. + const std::wstring remaining = string_to_wstring(remaining_raw_input_with_cases); + const std::wstring word = string_to_wstring(CandidateTextForOutput(current_word)); + const std::wstring preedit = word + string_to_wstring(GlobalIme::composition.segmented_pinyin); + return remaining + L'\t' + word + L'\t' + preedit; } bool IsCommitWithFirstCandidatePunctuationInCandidateMode(UINT keycode, WCHAR wch)