原「智能标点」是小狼毫 digit_separators 的语义:字母或数字后的 , . : 直出英文, 2 秒内再按同一标点转回中文——后半段靠 SendInput 往应用里补一个 Backspace 再打 字符,落点全靠光标当时在哪。这次换掉主路径:输入中文标点后按空格,用 TSF 编辑 会话就地把它改写成对应英文(。,!?;:、 → . , ! ? ; : /),2 秒内再按同一标点 键撤回中文;原来的直出降为子开关,整个家族默认全关、改为显式开启。 - 按键与会话:转换/撤回是本地文档改写,不进 IPC、不进延迟队列;判据落在 _IsKeyEaten,OnTestKeyDown 的预判与 _DispatchKeyDown 的第二遍预判共用同一份, 声称吃掉的键不交还宿主。改写走编辑会话,请求不上时另起一个最小会话把键本身 的字符写回去,避免已吃掉的键静默丢失。 - 状态:原来散落的九个成员收成一个 SmartPunctuationAction(None / ChineseCommitted / AsciiConverted),带焦点令牌、前台窗口和 beforeChar 指纹;清理以分类结果为准, 丢焦点与上下文栈变化一并清掉。 - 转换范围:。,!?;:、 与单独出现的 “”‘’【】《》() 都是映射表里的单字符 条目,路径完全一致;成对补全产生的一对(autoClosedPair)不 arm,按空格只落空格, 不会留下 <》 这类孤儿。 - 开关:总开关 + 中文标点后按空格转换 + 同键转回中文 + 数字后直出 + 字母后直出, 五键全部默认关;直出拆成数字/字母两个独立子开关(IPC 24 收窄为数字、25 追加为 字母),TSF 按前字符类型分别查键。 - 命名:子开关「独立符号」改名「中文标点后按空格转换」,配置键 smart_punctuation_standalone → smart_punctuation_space_convert,IPC 22 只改常量名 (SmartPunctuationSpaceConvertChanged),编号与语义不变、新旧测试包互通;设置页 文案同步重写,五处配置链路与死宿主一并跟改。 - 兼容:旧键未出厂、不迁移(升级合并按模板缺键丢弃、取默认 false);编号 23 随 「按空格整体转换一对」的设计退役并留空不复用。 - 验证:TSF x86/x64 与 Server Release 编译、Server 335 单测、windows_ipc_contract x64/x86、设置页 build + 27 测试、clang-format 18.1.8 全绿。真机未跑。 Signed-off-by: Jia Sui <jsfaint@gmail.com>
Input engine (engine/)
The C++ conversion engine behind Metasequoia IME for Windows: input sessions, candidate lookup, helpcodes, the shared contracts and the voice module.
This directory used to be a submodule of metasequoiaime/MSIME-Engine. It is now a component of this repository, a sibling of server/, ui/, windows/ and installer/. Its upstream commit, and exactly what the Windows specialization removed, are recorded in UPSTREAM.md. Treat it as first-party code: reviewed, formatted and tested like anything else here, no longer merged from upstream.
| Directory | Purpose |
|---|---|
core/, quanpin/, shuangpin/, english/, japanese/ |
Input sessions and candidate lookup |
contracts/ |
The authoritative IPC wire format, dictionary format, punctuation policy and WebView message schema |
helpcode/ |
Helpcode (形码) tables and generators |
local_modes/, providers/, user_dictionary/ |
Local modes, online candidate sources, the user dictionary |
voice/ |
Recording, WAV encoding, recognition and text cleanup; builds independently |
googlepinyinime-rev/, utfcpp/, voice/third_party/ |
Vendored third-party code, kept in its upstream formatting and licence |
Integration is through <metasequoia/session.h>. See runtime architecture.
Build
The product build does not build this directory on its own: server/CMakeLists.txt pulls it in with add_subdirectory, so CI compiles and exercises the engine through the server and the TSF frontend. After changing something here, run the server's build and tests.
Building it standalone still works and is much faster while working on the engine. Dependencies are CMake 3.25+, a C++17 compiler, Boost, fmt, spdlog and SQLite3.
vcpkg install --triplet x64-windows-static
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static
cmake --build build --config Release --parallel
ctest --test-dir build -C Release --output-on-failure --timeout 20
ctest runs every engine target registered in the root CMakeLists.txt: the segmentation, IPC and punctuation contracts, the platform API, data paths, runtime isolation, dictionary state and the per-mode session tests. tests/ additionally holds a separate Windows-only project that is not part of that build — add new tests to the registered targets so they actually run.
Formatting is driven from the repository root by scripts/format.sh, using the .clang-format in this directory (voice/ has its own with a wider column limit). The vendored third-party trees and the generated headers are excluded.
Contract rules
The IPC wire format, opcodes, voice framing and WebView message definitions live in contracts/ and are the single source of truth. Consumers include the same headers; do not restate them on either side. Dictionary naming is defined by contracts/dictionary/format.json, shared with the repository root's scripts/dictionary_product.py.
Data and licensing
The dictionaries are neither stored nor built here. They arrive as a release pinned by tag and digest in product-lock.json and are downloaded at build time; the pipeline that produced them left with the specialization. Per-source licensing is tracked in NOTICE.md — read it before redistributing the built databases.
Recognition goes through a cloud provider; local Whisper inference was removed. The only committed model is voice/assets/models/silero_vad.onnx, loaded solely by the standalone Windows host that is off by default.
Licence
GPL-3.0. Vendored googlepinyinime-rev, utfcpp and voice/third_party/miniaudio keep their upstream licences.