Skip to content

Commit

Permalink
fix: crash when prediction(librime-predict) on, when clicking on norm…
Browse files Browse the repository at this point in the history
…al candidate and there are predictions.
  • Loading branch information
fxliang authored and lotem committed Jan 19, 2024
1 parent fb80f61 commit 9061a1a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions WeaselTSF/CandidateList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,15 @@ void WeaselTSF::_DeleteCandidateList()
void WeaselTSF::_SelectCandidateOnCurrentPage(size_t index)
{
m_client.SelectCandidateOnCurrentPage(index);
// fake a emptyp presskey to get data back and DoEditSession
m_client.ProcessKeyEvent(0);
_UpdateComposition(_pEditSessionContext);
// simulate a VK_SELECT presskey to get data back and DoEditSession
// the simulated keycode must be the one make TranslateKeycode Non-Zero return
// fix me: are there any better ways?
INPUT inputs[2];
inputs[0].type = INPUT_KEYBOARD;
inputs[0].ki = {VK_SELECT, 0,0,0,0};
inputs[1].type = INPUT_KEYBOARD;
inputs[1].ki = {VK_SELECT, 0,KEYEVENTF_KEYUP,0,0};
::SendInput(sizeof(inputs) / sizeof(INPUT), inputs, sizeof(INPUT));
}

void WeaselTSF::_HandleMousePageEvent( bool* const nextPage, bool* const scrollNextPage)
Expand Down

0 comments on commit 9061a1a

Please sign in to comment.