Commit Graph
123 Commits
Author SHA1 Message Date
Evan Hu 06bba15d4f fix(server): keep settings I/O off UI thread and bound dictionary rendering 2026-09-06 03:31:40 +09:00
Evan Hu b5d07f11eb fix(server): reduce WebView message and first-paint overhead 2026-09-06 03:05:36 +09:00
Evan Hu 373f8d1473 refactor: collapse the duplicated submodules into one vendor/ directory
Windows, Server and UiHtml each carried their own gitlink to MSIME-Engine, all three pinned to the same commit, and Server carried a gitlink to MSIME-UI that is now the ui/ component. Git only reads the root .gitmodules, so the nested ones had to go regardless.

The engine and the two third-party dependencies now live once at vendor/MetasequoiaImeEngine, vendor/opencc and vendor/cpp-pinyin. Server reaches them through MSIME_VENDOR_DIR and builds ui/ as an out-of-tree subdirectory; the Windows tip's relative contract includes gained the extra level; the ui-html contract sync and the Server env/table generators follow the engine to its new location.
2026-09-06 02:27:52 +09:00
Evan Hu 8e54b79547 merge(main): retain direct shared local-mode calls and remove legacy adapters 2026-09-06 00:27:39 +09:00
Evan Hu 6783ff7175 refactor(session): use shared composition and local queries with one candidate view model 2026-09-06 00:26:38 +09:00
Evan Hu 60fce0f043 Merge branch main into feat/generic-pinyin-order-correction
唯一冲突是 engine 子模块指针,取 main 的当前值(其中已含本 PR 依赖的
MSIME-Engine#1,以及后续的 #20 门控修复)。
2026-09-05 23:34:30 +09:00
Evan 6ba26c3baf Merge pull request #30 from metasequoiaime/architecture/product-contracts
Use shared IPC definitions and negotiate main client sessions
2026-09-05 23:23:03 +09:00
Evan Hu 3c24076fad feat(webview): validate shared message contracts before native dispatch 2026-09-05 23:07:50 +09:00
Evan Hu 8a36ee264a test(quanpin): expect four-syllable alternatives and bound them at five
The engine pin moved 55839c8 -> 127019f in the previous commit, and that range contains 86c5fa7 "fix(quanpin): enumerate alternative segmentations for four-syllable input". QuanpinDictionaryOnlyTriesMultipleSegmentationsForAtMostThreeSyllables asserted the behaviour that fix deliberately changed, so it failed here and, through the product lock, in MSIME-Windows' locked-Server integration job as well.

The engine is the authoritative layer: quanpin/quanpin_dictionary.cpp declares kMaxSyllablesForMultipleSegmentations = 4 and gates enumeration on segments.size() <= that. Four syllables now enumerate alternatives; five still do not. The test says exactly that, with a tbl_6_x fixture row so the five-syllable case would have something to find if the bound ever moved silently.
2026-09-05 23:00:52 +09:00
Evan Hu e9c8fd4077 Merge remote-tracking branch 'origin/main' into pr2 2026-09-05 22:51:54 +09:00
Evan e6e4d593d3 refactor: use the engine's local mode queries instead of this repository's copies (#29)
The engine absorbed the six local mode queries during the cross-platform work,
and MSIME-Linux has been driving them in production since. This repository kept
its own implementations of the same six features, so date-time, emoji, kaomoji,
jianpin, quick-phrase and unicode each existed twice and were free to drift.

Deletes this repository's copies and points the eight call sites in
event_listener.cpp plus the two async workers at metasequoia::local_modes.

The shuangpin profile is the part to look at. The old modules resolved the
*configured* scheme themselves:

    GetShuangpinProfile(shuangpin_schema.empty() ? GetConfiguredShuangpinSchema()
                                                 : shuangpin_schema)

The engine takes a resolved ShuangpinProfile and defaults it to Xiaohe. Taking
that default would have decoded J mode, emoji and kaomoji as Xiaohe for every
user on Ziranma, Shoudao or Microsoft shuangpin, so every call site passes the
configured profile explicitly through a ConfiguredShuangpinProfile() helper.

The database path needs the same care in the other direction. The old modules
took a UTF-8 std::string and handed it straight to sqlite3_open_v2; the engine
takes a std::filesystem::path and converts back with path_to_utf8 before
opening. The two async workers therefore bridge with path_from_utf8 rather than
constructing a path from the narrow string, which on Windows would interpret a
non-ASCII data directory in the active code page.

The four existing test files are kept and re-pointed at the engine functions
with every expectation byte-identical, including the seventeen date-time format
strings and the four shuangpin schemes jianpin covers. They are the equivalence
check: if the engine's port diverged from what this repository shipped, those
assertions fail rather than the difference reaching users.
2026-09-05 22:20:17 +09:00
Evan Hu 937e1c4f4a Merge branch main into feat/generic-pinyin-order-correction
唯一冲突是 MetasequoiaImeEngine 子模块指针。本 PR 原本指向作者 fork 上的提交
1017239,该提交已随 MSIME-Engine#1 合入引擎 main,因此改为指向引擎 main 当前
的 ecb28f6,它同时包含 #1 #5 #6 #18。
2026-09-05 22:17:22 +09:00
Evan 4ee0ecd263 Merge pull request #15 from ouchihao/codex/fix-110-english-candidate-ranking
fix(candidates): honor English ranking in mixed input
2026-09-05 21:53:31 +09:00
Evan 261035a33c chore: consume the engine as a library and stop prepare_env clobbering the build (#14)
* chore: consume the engine as a library and stop prepare_env clobbering the build

The engine submodule was pinned at a197746, eight commits behind the engine's
main branch and older than the commit that first gave the engine a CMakeLists
of its own. That is why this repository listed the engine's translation units
by hand: at the pinned commit there was no target to link against. There is
one now, and Apple and Linux already consume it, so do the same here.

- advance the engine submodule from a197746 to 8cc306c
- add_subdirectory the engine and link MetasequoiaIme::Engine from the server,
  the dictionary replay tool and the settings executable, dropping the two
  hand-maintained source lists
- point the engine and msimeui submodule URLs at MSIME-Engine and MSIME-UI,
  and update the README, which still used the pre-rename repository names

prepare_env.py, which the README tells every new contributor to run first,
overwrote four tracked build files from templates under scripts/config_files
that had fallen years behind:

- CMakeLists.txt was replaced by a 147-line copy of what is now a 400-line
  build, dropping opencc, cpp-pinyin, msimeui, settings and the panels
- tests/CMakeLists.txt was replaced by an unrelated generic WinCppTemplate
- CMakePresets.json lost the vcpkg-release preset that llaunch-release.ps1
  needs

Running the documented first build step therefore broke the build. The script
now only writes the two files that are genuinely generated, and rewrites
CMakePresets.json in place instead of copying a stale template over it.

The .clangd generation addressed template lines by index and the indices had
drifted: the Boost path was written over the WebView2 include and the Sciter
path over a comment, leaving clangd unable to resolve the WebView2 headers.
The template now carries named placeholders, and the script fails loudly if
any are left unsubstituted.

Also remove src/sciter. It is a third candidate window backend that no
CMakeLists has referenced for some time; the shipped backends are d2d and
webview2, and those are the only two ui_backend accepts.

* docs: keep the historical checkout directory names in the build steps

The clone URLs had to change, since the old ones only resolved through
GitHub's rename redirect, but cloning without an explicit target would also
have renamed the working directories. MSIME-Windows's AGENTS.md records that
the historical directory names are deliberate: msime-installer's
Prepare-PackageFiles.ps1 expects siblings called MetasequoiaImeServer and
MetasequoiaImeDict, and the release workflow checks the current repositories
out into exactly those paths. Clone into them explicitly instead.

* chore: re-pin the engine at the WIN32_LEAN_AND_MEAN fix

Moves the submodule from 8cc306c to f91cd20. That carries metasequoiaime/MSIME-Engine#14,
which stops the engine exporting WIN32_LEAN_AND_MEAN as a PUBLIC compile definition and so
unblocks MetasequoiaImeSettings, whose WebView2.h include failed with 101 instances of C2146
against the trimmed Windows.h the definition forced on every consumer.

The range also picks up the two dependabot merges the engine took in the meantime: #12 bumps
utfcpp and #13 bumps the pinned action SHAs.

* build(tests): link the engine target instead of listing its sources

The test executable hand-listed the same 41 engine translation units the root
CMakeLists.txt did, and compiled them without NOMINMAX. That went unnoticed
while the pinned engine predated core/key_event.h; now that the engine headers
pull in Windows.h, the min and max macros collide with std::max and the build
fails with C2589 in quanpin_query.cpp.

Linking MetasequoiaIme::Engine fixes it at the source: NOMINMAX is one of the
definitions the engine exports PUBLIC precisely because it changes the declared
API surface.

* docs(agents): correct the tests wiring and describe the new prepare_env

Two sections went stale or were inaccurate.

The tests section said the root CMakeLists.txt does not reference tests/ at
all. It does: include(CTest) at :8 defaults BUILD_TESTING to ON and :411
add_subdirectory(tests) picks it up, so the test target is configured and
compiled on every CI run. This PR proved it from the other side, by breaking
the test target's build with a NOMINMAX regression that CI caught. The real
gap is narrower and still worth the warning: ci.yml has no ctest step, so the
executable is built and never run.

The generated-files section described prepare_env.py copying templates over
CMakeLists.txt and CMakePresets.json by fixed line index. This PR removes that
behaviour, so the section now describes what the script actually does.
2026-09-05 19:02:43 +09:00
Ouchihao 2af10f56aa fix(candidates): honor English ranking in mixed input 2026-09-05 16:40:31 +08:00
fanlusky 82048fb8be Add a setting to always use Chinese/English punctuation. 2026-09-02 20:53:04 +08:00
fanlusky 7e8fbf8e7c Fix kei missing in shuangpin. 2026-09-02 16:40:46 +08:00
fanlusky 5c02503139 Render the candidate window with D2D instead of WebView2
Drive the existing candidate HWND through CandidatePresenter and msimeui,
keep WebView2 for the menu, floating toolbar, and settings, and load
external skins from skin.toml color tokens. Restore cloud/AI badges on
D2D items, and keep click, pin, fix-position, and delete on the same
window messages as before.
2026-09-02 15:30:03 +08:00
Jia Sui fbb2a56eaf style: apply clang-format to the new autocorrect tests 2026-08-31 16:01:49 +08:00
Jia Sui bfd42d314e 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
2026-08-31 16:01:25 +08:00
fanlusky 2effb7c393 Add support for the DeepLX translation service. 2026-08-30 15:39:02 +08:00
fanlusky 7c0461fe3a Fix adjust word frequency issue. 2026-08-29 23:56:50 +08:00
Manwood ea30b5fe90 test(quanpin): cover additional typo aliases 2026-08-26 17:17:10 +08:00
Manwood 6e97113899 test(quanpin): cover generic typo corrections
Update the engine submodule and add regression coverage for suffix-based corrections, ambiguous ehng interpretations, and continuous input.
2026-08-26 14:14:34 +08:00
fanlusky 27a7143050 Fix the issue where English words created by Enter cannot be replayed during new version installation. 2026-08-25 22:50:06 +08:00
fanlusky 1eef18401c Fix the issue where long sentence translations are not fully displayed. 2026-08-25 20:01:48 +08:00
fanlusky 38fe99be62 Add a function that commits the raw string when the Enter key is pressed and records the string into the dictionary. 2026-08-25 19:05:25 +08:00
fanlusky dafc7d6040 Optimize the logging on both the TSF and Server sides to facilitate issue diagnosis. 2026-08-25 13:53:30 +08:00
fanlusky bf0712cffd Further standardize the issue of batch importing dictionaries. 2026-08-25 11:58:33 +08:00
fanlusky b159d8c9ab Update local path. Optimize audio interruption. 2026-08-23 23:37:00 +08:00
fanlusky 03b4dfeff4 Supplement: Tencent Cloud API translation from English to Chinese, and API invocation. 2026-08-22 19:44:06 +08:00
fanlusky e42cc92b8e Attempt to fix the flickering issue with Microsoft Shuangpin. Add an R mode for temporary Japanese input. 2026-08-22 16:54:29 +08:00
fanlusky 5da93af45c Optimize Japanese queries. 2026-08-22 12:03:55 +08:00
fanlusky 7bc55dab39 Integrate the Tencent Cloud Machine Translation API. 2026-08-22 02:22:38 +08:00
fanlusky 0eb5478cd3 Implement the whole-sentence algorithm and fuzzy query for Japanese. 2026-08-22 01:18:04 +08:00
fanlusky 1cf7846382 There should also be a corresponding status indicator when the keyboard Caps Lock is turned on. 2026-08-21 23:09:03 +08:00
fanlusky 6960a74fce Add dynamic switching of Japanese icons. 2026-08-21 17:33:37 +08:00
fanlusky 27b0974be1 Add preliminary support for Japanese input. 2026-08-21 16:55:41 +08:00
fanlusky e885856124 Add Chinese-English translation functionality during typing. 2026-08-21 16:04:50 +08:00
fanlusky a9f8ee0be6 Provide more slots for custom prompts. 2026-08-21 12:58:40 +08:00
fanlusky 7c36a8e1b6 Change the default model for SiliconFlow. 2026-08-21 11:30:06 +08:00
fanlusky 70014c8c2a Enable voice input to support multiple vendors. 2026-08-20 21:17:41 +08:00
fanlusky e08feaa713 Add regression tests for the issue where promoting xianwang candidates hid 先 from later xian queries.
Fixes metasequoiaime/MetasequoiaImeTsf#36
2026-08-20 14:01:00 +08:00
fanlusky 943b6fbd4b Add J mode, the shorthand pinyin mode. 2026-08-19 08:05:44 +08:00
fanlusky 7c7df2e4c6 Add inline preedit in-time ars result support for voice input. 2026-08-17 00:55:45 +08:00
fanlusky 8565b0531b Add kaomoji to mixed candidates (after emoji) behind general.kaomoji_mixed_input
kaomoji_ime: async worker mirroring emoji_ime; KaomojiQuery::QueryPrefix
gains a db_path override. NormalizeMixedCandidateOrder places kaomoji right
after emoji, shifting with cloud/AI. event_listener wires
UpdateKaomojiInput/ApplyKaomojiCandidates/EnqueueKaomojiCandidates and the
PrepareCandidateList trigger; config general.kaomoji_mixed_input is plumbed
through settings_app/webview2; main.cpp starts/stops KaomojiIme; ordering test
added.
2026-08-17 00:08:24 +08:00
fanlusky 7a35c8c20e Add M-mode (Shift+M) for quick kaomoji input
Shift+M enters a kaomoji quick-input mode backed by the kaomoji table in
others.db, supporting full pinyin, abbreviated pinyin, English words, and
shuangpin expansion. Candidates commit directly via the new
CandidateSource::Kaomoji; a [utility] kaomoji_mode toggle is wired through
settings. Hardens candidate payload rendering (HTML / backtick / comma
escaping) so kaomoji, which often contain < > &  and commas, display correctly.
2026-08-16 23:16:11 +08:00
fanlusky d15319bd66 Add emoji to mixed candidates (slot 3, shifts with cloud/AI) behind general.emoji_mixed_input. 2026-08-16 19:29:52 +08:00
fanlusky 08ee504609 Add E-mode (Shift+E) for quick emoji input
Shift+E enters an emoji quick-input mode backed by the emoji_pinyin index in
others.db, supporting full pinyin (xiaolian), abbreviated pinyin (xl), English
words (laugh), and shuangpin codes (Xiaohe xnlm expands to xiaolian).

- src/emoji/emoji_query.{h,cpp}: prefix lookup over emoji_pinyin with
  shuangpin->quanpin expansion driven by the active scheme
- event_listener: Shift+E trigger, composition helpers, candidate branch, and
  direct commit through the new CandidateSource::Emoji
- config: [utility] emoji_mode toggle wired through settings_app / webview2
- tests: emoji_query coverage for full/abbrev pinyin, English, Xiaohe shuangpin
- engine submodule: CandidateSource::Emoji (core/word_item.h)
2026-08-16 18:54:54 +08:00
fanlusky c18898f7d9 Add weekday quick input (xq/xingqi/week) to the T-mode and keep T-mode from leaking normal pinyin candidates. 2026-08-16 17:48:11 +08:00