feat(quanpin): wire up typing autocorrect config and tests

- config.toml [quanpin] autocorrect = true (default on)
- ime_config: GetConfiguredQuanpinAutocorrectEnabled /
  SetConfiguredQuanpinAutocorrectEnabled with template-preserving write
- engine_input_session injects the flag into the engine session
- tests: autocorrect table integrity, autocorrect_cut units, dictionary-level
  corrected-candidate-first behavior, legacy behavior when disabled, and
  cache isolation for plain spellings
- bump MetasequoiaImeEngine to 2422fd1
This commit is contained in:
Jia Sui committed 2026-08-31 16:01:25 +08:00
1 parent 9e4296d1c5
commit bfd42d314e
7 files changed
+348 -1

No files matched your search

@@ -185,6 +185,7 @@ EngineInputSession::EngineInputSession(SchemeType scheme_type, const ShuangpinPr
SelectConfiguredHelpcodeSchema(scheme_type);
session_.set_shuangpin_helpcode_enabled(GetConfiguredShuangpinHelpcodeEnabled());
session_.set_quanpin_helpcode_enabled(GetConfiguredQuanpinHelpcodeEnabled());
session_.set_quanpin_autocorrect_enabled(GetConfiguredQuanpinAutocorrectEnabled());
}
void EngineInputSession::handle_key(UINT vk, UINT modifiers_down, WCHAR wch)
@@ -192,6 +193,7 @@ void EngineInputSession::handle_key(UINT vk, UINT modifiers_down, WCHAR wch)
SelectConfiguredHelpcodeSchema(current_scheme_type());
session_.set_shuangpin_helpcode_enabled(GetConfiguredShuangpinHelpcodeEnabled());
session_.set_quanpin_helpcode_enabled(GetConfiguredQuanpinHelpcodeEnabled());
session_.set_quanpin_autocorrect_enabled(GetConfiguredQuanpinAutocorrectEnabled());
session_.handle_key(vk, modifiers_down, wch);
}
@@ -200,6 +202,7 @@ void EngineInputSession::recompute_candidates()
SelectConfiguredHelpcodeSchema(current_scheme_type());
session_.set_shuangpin_helpcode_enabled(GetConfiguredShuangpinHelpcodeEnabled());
session_.set_quanpin_helpcode_enabled(GetConfiguredQuanpinHelpcodeEnabled());
session_.set_quanpin_autocorrect_enabled(GetConfiguredQuanpinAutocorrectEnabled());
if (has_pending_pinyin_sequence_ || has_pending_pinyin_sequence_with_cases_)
{
apply_pending_sequence();