Skip to content

Commit

Permalink
chore: more detail log info when key_binder/bindings parsing errors h…
Browse files Browse the repository at this point in the history
…appen (#922)
  • Loading branch information
fxliang authored Aug 17, 2024
1 parent cdab893 commit 3c1c478
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/rime/gear/key_binder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,25 @@ void KeyBindings::LoadBindings(const an<ConfigList>& bindings) {
}
KeyEvent key;
if (!key.Parse(pattern->str())) {
LOG(WARNING) << "invalid key binding #" << i << ".";
LOG(WARNING) << "invalid key binding #" << i
<< ", with invalid accept pattern: " << pattern->str()
<< ".";
continue;
}
if (auto target = map->GetValue("send")) {
KeyEvent key;
if (key.Parse(target->str())) {
binding.target.push_back(std::move(key));
} else {
LOG(WARNING) << "invalid key binding #" << i << ".";
LOG(WARNING) << "invalid key binding #" << i
<< ", with invalid send pattern: " << target->str() << ".";
continue;
}
} else if (auto target = map->GetValue("send_sequence")) {
if (!binding.target.Parse(target->str())) {
LOG(WARNING) << "invalid key sequence #" << i << ".";
LOG(WARNING) << "invalid key sequence #" << i
<< ", with invalid send_sequence pattern: "
<< target->str() << ".";
continue;
}
} else if (auto option = map->GetValue("toggle")) {
Expand All @@ -211,7 +216,9 @@ void KeyBindings::LoadBindings(const an<ConfigList>& bindings) {
select_schema(engine, schema->str());
};
} else {
LOG(WARNING) << "invalid key binding #" << i << ".";
LOG(WARNING) << "invalid key binding #" << i
<< ", accept: " << pattern->str()
<< ", when: " << whence->str() << ".";
continue;
}
Bind(key, binding);
Expand Down

0 comments on commit 3c1c478

Please sign in to comment.