Skip to content

Commit

Permalink
Uses exact UTF32 code point count.
Browse files Browse the repository at this point in the history
  • Loading branch information
zonble committed Dec 26, 2023
1 parent 14fe216 commit 51bf2e6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/McBopomofo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,13 +747,9 @@ fcitx::CandidateLayoutHint McBopomofoEngine::getCandidateLayoutHint() const {
if (choosingCandidate != nullptr) {
auto candidates = choosingCandidate->candidates;
for (auto candidate : candidates) {
if (candidate.value.length() > 8) {
return fcitx::CandidateLayoutHint::Vertical;
}
}
if (candidates.size() > 0) {
auto firstCandidate = candidates[0];
if (firstCandidate.value.length() > 8) {
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> conv;
auto u32 = conv.from_bytes(candidate.value);
if (u32.size() > 8) {
return fcitx::CandidateLayoutHint::Vertical;
}
}
Expand Down

0 comments on commit 51bf2e6

Please sign in to comment.