From 51bf2e6cb6de49c0e32b8bd25102524b2a76defd Mon Sep 17 00:00:00 2001 From: zonble Date: Tue, 26 Dec 2023 22:40:44 +0800 Subject: [PATCH] Uses exact UTF32 code point count. --- src/McBopomofo.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/McBopomofo.cpp b/src/McBopomofo.cpp index d862972..ce673e1 100644 --- a/src/McBopomofo.cpp +++ b/src/McBopomofo.cpp @@ -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, char32_t> conv; + auto u32 = conv.from_bytes(candidate.value); + if (u32.size() > 8) { return fcitx::CandidateLayoutHint::Vertical; } }