Skip to content

Commit

Permalink
apply clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
mokapsing authored Jun 27, 2024
1 parent 9272f05 commit ccf3aef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
18 changes: 9 additions & 9 deletions src/rimeengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,18 +756,18 @@ void RimeEngine::updateSchemaMenu() {
schemas_.push_back(schemaId);
}
api_->free_schema_list(&list);

schemActions_.emplace_back();
auto &schemaAction = schemActions_.back();
schemaAction.setShortText(_("Next Schema"));
schemaAction.connect<SimpleAction::Activated>(
[this](InputContext *ic) {
auto state = ic->propertyFor(&factory_);
blockNotificationFor(30000);
state->switchNextSchema();
imAction_->update(ic);
});
instance_->userInterfaceManager().registerAction("fcitx-rime-next-schema", &schemaAction);
schemaAction.connect<SimpleAction::Activated>([this](InputContext *ic) {
auto state = ic->propertyFor(&factory_);
blockNotificationFor(30000);
state->switchNextSchema();
imAction_->update(ic);
});
instance_->userInterfaceManager().registerAction(
"fcitx-rime-next-schema", &schemaAction);
schemaMenu_.insertAction(&separatorAction_, &schemaAction);
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/rimestate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void RimeState::selectSchema(const std::string &schema) {
void RimeState::switchNextSchema() {
std::string currentSchemaId;
std::string targetSchemaId;
const auto& schemas = engine_->schemas();
const auto &schemas = engine_->schemas();
auto api = engine_->api();
if (api->is_maintenance_mode()) {
return;
Expand All @@ -169,7 +169,7 @@ void RimeState::switchNextSchema() {
targetSchemaId = *schemas.begin();
if (!schemas.empty()) {
auto it = std::find(schemas.begin(), schemas.end(), currentSchemaId);
if (it != schemas.end() && std::next(it) != schemas.end()) {
if (it != schemas.end() && std::next(it) != schemas.end()) {
targetSchemaId = *std::next(it);
}
}
Expand Down Expand Up @@ -525,7 +525,8 @@ void RimeState::restore() {
if (savedCurrentSchema_.empty()) {
return;
}
if (!std::count(engine_->schemas().begin(), engine_->schemas().end(), savedCurrentSchema_)) {
if (!std::count(engine_->schemas().begin(), engine_->schemas().end(),
savedCurrentSchema_)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/rimestate.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <string_view>
#include <vector>

#define RIME_ASCII_MODE "ascii_mode"
#define RIME_ASCII_MODE "ascii_mode"
#define FCITX_HIDE_CANDIDATES "_hide_candidate"

namespace fcitx {
Expand Down

0 comments on commit ccf3aef

Please sign in to comment.