Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Asks the input method to use the vertical candidate window when there is a long candidate. #102

Merged
merged 3 commits into from
Dec 26, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/McBopomofo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,20 @@ void McBopomofoEngine::handleMarkingState(fcitx::InputContext* context,

fcitx::CandidateLayoutHint McBopomofoEngine::getCandidateLayoutHint() const {
fcitx::CandidateLayoutHint layoutHint = fcitx::CandidateLayoutHint::NotSet;

auto choosingCandidate =
dynamic_cast<InputStates::ChoosingCandidate*>(state_.get());
if (choosingCandidate != nullptr) {
auto candidates = choosingCandidate->candidates;
for (auto candidate : candidates) {
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> conv;
tianjianjiang marked this conversation as resolved.
Show resolved Hide resolved
auto u32 = conv.from_bytes(candidate.value);
if (u32.size() > 8) {
return fcitx::CandidateLayoutHint::Vertical;
}
}
}

switch (config_.candidateLayout.value()) {
case McBopomofo::CandidateLayoutHint::Vertical:
layoutHint = fcitx::CandidateLayoutHint::Vertical;
Expand Down