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

regression: delete candidate of any index #945

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
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
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