Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: on hover actions, performance enhancement, less ui update. #1060

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions WeaselTSF/CandidateList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,22 +454,25 @@ void WeaselTSF::_HandleMousePageEvent( bool* const nextPage, bool* const scrollN

void WeaselTSF::_HandleMouseHoverEvent(const size_t index)
{
// ToDo: if feature new api comes, replace the processes bellow
UINT current_select = 0;
_cand->GetSelection(&current_select);
weasel::KeyEvent ke{ 0, 0 };
ke.keycode = current_select < index ? ibus::Down : ibus::Up;

int inc = index > current_select ? 1 : (index < current_select ) ? -1 : 0;
if (_cand->GetIsReposition()) inc = -inc;
if(index != current_select)
{
for(auto i=0; i < abs((INT)((INT)index - (INT)current_select)); i++)
// simuulate change current_select in librime
// maybe replace with new api in the future
weasel::KeyEvent ke{ 0, 0 };
ke.keycode = current_select < index ? ibus::Down : ibus::Up;
int inc = index > current_select ? 1 : -1;
if (_cand->GetIsReposition()) inc = -inc;
UINT gap = abs((INT)((INT)index - (INT)current_select));
for(UINT i=0; i < gap; i++)
{
_cand->SetSelection(current_select + inc);
m_client.ProcessKeyEvent(ke);
_UpdateComposition(_pEditSessionContext);
}
// simuulate change current_select end
_cand->SetSelection(current_select + inc * gap);
_UpdateComposition(_pEditSessionContext);
}
}

Expand Down