STDAPI CTextService::OnEndEdit(ITfContext *pic, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord) { if(_IsComposing() && pic != nullptr) { ITfRange *pRange = nullptr; if(SUCCEEDED(_pComposition->GetRange(&pRange)) && (pRange != nullptr)) { // clear when auto completion BOOL fEmpty = FALSE; if(SUCCEEDED(pRange->IsEmpty(ecReadOnly, &fEmpty)) && fEmpty) { if(!roman.empty() || !kana.empty()) { _ResetStatus(); _EndComposition(pic); } } // reposition candidate window if(_pCandidateList != nullptr) { ITfContextView *pContextView = nullptr; if(SUCCEEDED(pic->GetActiveView(&pContextView)) && (pContextView != nullptr)) { RECT rc = {}; BOOL fClipped; if(SUCCEEDED(pContextView->GetTextExt(ecReadOnly, pRange, &rc, &fClipped))) { _pCandidateList->_Move(&rc, ecReadOnly, pic); } SafeRelease(&pContextView); } } SafeRelease(&pRange); } } return S_OK; }