Skip to content

Commit

Permalink
regression: delete candidate of any index (#945)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored Oct 14, 2024
1 parent b907d7d commit b74f5fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
15 changes: 5 additions & 10 deletions src/rime/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,26 +143,21 @@ bool Context::Highlight(size_t index) {
return true;
}

bool Context::DeleteCandidate(an<Candidate> 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() {
Expand Down
1 change: 0 additions & 1 deletion src/rime/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ class RIME_API Context {

private:
string GetSoftCursor() const;
bool DeleteCandidate(an<Candidate> cand);

string input_;
size_t caret_pos_ = 0;
Expand Down

0 comments on commit b74f5fa

Please sign in to comment.