Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 7 additions & 1 deletion src/KeyHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1125,12 +1125,18 @@ bool KeyHandler::handleNumberInput(Key key,
std::make_unique<InputStates::NumberInput>(newNumber, candidates);
stateCallback(std::move(newState));
return true;
} else if (!state->candidates.empty()) {
// If the candidate panel is visible, let it handle the key.
return false;
} else if (std::isprint(key.ascii)) {
// Reject all other printable, non-numeric keys.
errorCallback();
return true;
}

return false;
// If the buffer is empty, all other keys (e.g. cursor keys) exit the state.
stateCallback(std::make_unique<InputStates::EmptyIgnoringPrevious>());
return true;
}

bool KeyHandler::handleBig5(Key key, McBopomofo::InputStates::Big5* state,
Expand Down
7 changes: 0 additions & 7 deletions src/McBopomofo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,13 +716,6 @@ void McBopomofoEngine::keyEvent(const fcitx::InputMethodEntry& /*unused*/,
keyEvent.filterAndAccept();
return;
}
InputStates::NumberInput* currentNumberInput =
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition will never be true, since the key can only be unhandled if there are candidates in the NumberInput state.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I meant to put this on line 722, but put in on 719 instead.)

dynamic_cast<InputStates::NumberInput*>(state_.get());
if (currentNumberInput != nullptr) {
if (currentNumberInput->candidates.empty()) {
return;
}
}
}

if (dynamic_cast<InputStates::ChoosingCandidate*>(state_.get()) != nullptr ||
Expand Down