Skip to content

Commit

Permalink
Use new setComment API for candidate (#94)
Browse files Browse the repository at this point in the history
Co-authored-by: Weng Xuetian <wengxt@gmail.com>
  • Loading branch information
eagleoflqj and wengxt authored Apr 2, 2024
1 parent 92a4410 commit 395500a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include(ECMSetupVersion)
include(ECMUninstallTarget)

find_package(Gettext REQUIRED)
find_package(Fcitx5Core 5.1.7 REQUIRED)
find_package(Fcitx5Core 5.1.9 REQUIRED)
find_package(Fcitx5Module REQUIRED COMPONENTS Notifications)
find_package(PkgConfig REQUIRED)

Expand Down
18 changes: 6 additions & 12 deletions src/rimecandidate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ RimeCandidateWord::RimeCandidateWord(RimeEngine *engine,
const RimeCandidate &candidate, KeySym sym,
int idx)
: CandidateWord(), engine_(engine), sym_(sym), idx_(idx) {
Text text;
text.append(std::string(candidate.text));
if (candidate.comment && strlen(candidate.comment)) {
text.append(" ");
text.append(std::string(candidate.comment));
setText(Text{candidate.text});
if (candidate.comment && candidate.comment[0]) {
setComment(Text{candidate.comment});
}
setText(text);
}

void RimeCandidateWord::select(InputContext *inputContext) const {
Expand All @@ -45,13 +42,10 @@ RimeGlobalCandidateWord::RimeGlobalCandidateWord(RimeEngine *engine,
const RimeCandidate &candidate,
int idx)
: CandidateWord(), engine_(engine), idx_(idx) {
Text text;
text.append(std::string(candidate.text));
if (candidate.comment && strlen(candidate.comment)) {
text.append(" ");
text.append(std::string(candidate.comment));
setText(Text{candidate.text});
if (candidate.comment && candidate.comment[0]) {
setComment(Text{candidate.comment});
}
setText(text);
}

void RimeGlobalCandidateWord::select(InputContext *inputContext) const {
Expand Down

0 comments on commit 395500a

Please sign in to comment.