Skip to content

Commit

Permalink
initialize all options even without reset
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Oct 29, 2023
1 parent 2af844d commit a2b4316
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/rime/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,13 @@ void ConcreteEngine::InitializeOptions() {
Config* config = schema_->config();
Switches switches(config);
switches.FindOption([this](Switches::SwitchOption option) {
if (option.reset_value >= 0) {
if (option.type == Switches::kToggleOption) {
context_->set_option(option.option_name, (option.reset_value != 0));
} else if (option.type == Switches::kRadioGroup) {
context_->set_option(
option.option_name,
static_cast<int>(option.option_index) == option.reset_value);
}
int reset_value = option.reset_value >= 0 ? option.reset_value : 0;
if (option.type == Switches::kToggleOption) {
context_->set_option(option.option_name, reset_value != 0);
} else if (option.type == Switches::kRadioGroup) {
context_->set_option(
option.option_name,
static_cast<int>(option.option_index) == reset_value);
}
return Switches::kContinue;
});
Expand Down

0 comments on commit a2b4316

Please sign in to comment.