diff --git a/src/rime/context.cc b/src/rime/context.cc index 1e325cd83..43f0b418e 100644 --- a/src/rime/context.cc +++ b/src/rime/context.cc @@ -143,26 +143,21 @@ bool Context::Highlight(size_t index) { return true; } -bool Context::DeleteCandidate(an cand) { - if (!cand) - return false; - DLOG(INFO) << "Deleting candidate: " << cand->text(); - delete_notifier_(this); - return true; // CAVEAT: this doesn't mean anything is deleted for sure -} - bool Context::DeleteCandidate(size_t index) { if (composition_.empty()) return false; Segment& seg(composition_.back()); - return DeleteCandidate(seg.GetCandidateAt(index)); + seg.selected_index = index; + DLOG(INFO) << "Deleting candidate: " << seg.GetSelectedCandidate()->text(); + delete_notifier_(this); + return true; // CAVEAT: this doesn't mean anything is deleted for sure } bool Context::DeleteCurrentSelection() { if (composition_.empty()) return false; Segment& seg(composition_.back()); - return DeleteCandidate(seg.GetSelectedCandidate()); + return DeleteCandidate(seg.selected_index); } bool Context::ConfirmCurrentSelection() { diff --git a/src/rime/context.h b/src/rime/context.h index 3c06a9dd9..015e4a86e 100644 --- a/src/rime/context.h +++ b/src/rime/context.h @@ -94,7 +94,6 @@ class RIME_API Context { private: string GetSoftCursor() const; - bool DeleteCandidate(an cand); string input_; size_t caret_pos_ = 0;