-
Notifications
You must be signed in to change notification settings - Fork 15
Fix paging button doesn't update highlight #74
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
base: fcitx
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,8 @@ class MozcCandidateWord final : public CandidateWord { | |
| mozc_state->SelectCandidate(id_); | ||
| } | ||
|
|
||
| int32_t getId() const { return id_; } | ||
|
|
||
| private: | ||
| int id_; | ||
| MozcEngine *engine_; | ||
|
|
@@ -232,10 +234,12 @@ class MozcCandidateList final : public CandidateList, | |
| void prev() override { | ||
| auto *mozc_state = engine_->mozcState(ic_); | ||
| mozc_state->Paging(true); | ||
| highlightFirstCandidate(mozc_state); | ||
| } | ||
| void next() override { | ||
| auto *mozc_state = engine_->mozcState(ic_); | ||
| mozc_state->Paging(false); | ||
| highlightFirstCandidate(mozc_state); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think paging will actually create a new candidate list object. I don't know if the candidate id can be used but I think we'd better not relying on that.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we figure out how paging key update the cursor? |
||
| } | ||
|
|
||
| bool usedNextBefore() const override { return true; } | ||
|
|
@@ -247,6 +251,15 @@ class MozcCandidateList final : public CandidateList, | |
| } | ||
| } | ||
|
|
||
| void highlightFirstCandidate(MozcState *mozc_state) { | ||
| auto candidates = ic_->inputPanel().candidateList(); | ||
| if (!candidates->empty()) { | ||
| const auto &candidate = | ||
| dynamic_cast<const MozcCandidateWord &>(candidates->candidate(0)); | ||
| mozc_state->HighlightCandidate(candidate.getId()); | ||
| } | ||
| } | ||
|
|
||
| InputContext *ic_; | ||
| MozcEngine *engine_; | ||
| std::vector<Text> labels_; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no "get" in name.