Skip to content

delete candidate APIs ignore index #899

@eagleoflqj

Description

@eagleoflqj

Describe the bug

delete_candidate and delete_candidate_on_current_page ignore index and always delete highlighted candidate.

To Reproduce

  1. In luna-pinyin, commit 2 words with the same pinyin and not in dict.
  2. Right click the 2nd one on f5m or long press the 2nd one on f5a.
  3. Forget word.
  4. The 1st word is gone.

Expected behavior

The 2nd word is gone.

Log

I20240619 12:02:23.835766 0x170437000 context.cc:152] Deleting candidate: '苫次
I20240619 12:02:23.835961 0x170437000 memory.cc:127] deleting entry: '善此'.
I20240619 12:02:23.836090 0x170437000 level_db.cc:182] update db entry: shan ci 善此 => c=-1 d=0.99005 t=3

Flavor(please complete the following information):

  • fcitx5-rime (macOS)
  • fcitx5-rime (Android)

Additional context

Candidate info is clearly lost:

librime/src/rime/context.cc

Lines 151 to 154 in a4f24fd

if (auto cand = get_candidate(seg)) {
DLOG(INFO) << "Deleting candidate: '" << cand->text();
delete_notifier_(this);
return true; // CAVEAT: this doesn't mean anything is deleted for sure

Always delete selected:

auto phrase =
As<Phrase>(Candidate::GetGenuineCandidate(ctx->GetSelectedCandidate()));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions