diff --git a/src/McBopomofo.cpp b/src/McBopomofo.cpp index a865d9d..d862972 100644 --- a/src/McBopomofo.cpp +++ b/src/McBopomofo.cpp @@ -741,6 +741,24 @@ void McBopomofoEngine::handleMarkingState(fcitx::InputContext* context, fcitx::CandidateLayoutHint McBopomofoEngine::getCandidateLayoutHint() const { fcitx::CandidateLayoutHint layoutHint = fcitx::CandidateLayoutHint::NotSet; + + auto choosingCandidate = + dynamic_cast(state_.get()); + 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) { + return fcitx::CandidateLayoutHint::Vertical; + } + } + } + switch (config_.candidateLayout.value()) { case McBopomofo::CandidateLayoutHint::Vertical: layoutHint = fcitx::CandidateLayoutHint::Vertical;