From 184ee67e70aab0effaed992ca5e27115eca15835 Mon Sep 17 00:00:00 2001 From: fanlumaster <1730976608@qq.com> Date: Tue, 16 Sep 2025 15:48:58 +0800 Subject: [PATCH] [chore]: remove hard code and revert segmentation --- server/src/defines/defines.h | 3 ++- server/src/window/candidate_window.cpp | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/server/src/defines/defines.h b/server/src/defines/defines.h index a31f8c2d..f469c62d 100644 --- a/server/src/defines/defines.h +++ b/server/src/defines/defines.h @@ -7,4 +7,5 @@ // inline UINT WM_SHOW_MAIN_WINDOW; inline UINT WM_HIDE_MAIN_WINDOW; -inline UINT WM_MOVE_CANDIDATE_WINDOW; \ No newline at end of file +inline UINT WM_MOVE_CANDIDATE_WINDOW; +inline const UINT WM_CLS_DICT_CACHE = WM_USER + 100; \ No newline at end of file diff --git a/server/src/window/candidate_window.cpp b/server/src/window/candidate_window.cpp index dd0a338b..2d70829f 100644 --- a/server/src/window/candidate_window.cpp +++ b/server/src/window/candidate_window.cpp @@ -9,7 +9,6 @@ #include #include #include -#include "MetasequoiaImeEngine/shuangpin/pinyin_utils.h" #include "webview2/candidate_window_webview2.h" #include "utils/webview_utils.h" #include "utils/window_utils.h" @@ -145,8 +144,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) int caretY = Global::Point[1]; /* Read candidate string */ ::ReadDataFromSharedMemory(0b1000000); - std::wstring embeded_pinyin = string_to_wstring( // - PinyinUtil::pinyin_segmentation(wstring_to_string(Global::PinyinString)) // + std::wstring embeded_pinyin = string_to_wstring( // + g_dictQuery->get_segmentation_pinyin() // ); std::wstring str = embeded_pinyin + L"," + Global::CandidateString; InflateCandidateWindow(str); @@ -246,6 +245,14 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } break; } + + /* Clear dictionary buffer cache */ + case WM_CLS_DICT_CACHE: { + g_dictQuery->reset_cache(); + OutputDebugString(fmt::format(L"Cleared dictionary buffer cache.").c_str()); + break; + } + case WM_DESTROY: { PostQuitMessage(0); break;