Commit Graph
686 Commits
Author SHA1 Message Date
Jia Sui a3b1e4380c feat(server): 模糊音首次启用播种规则并持久化标记
总开关默认关不变;出厂态(fuzzy_seeded 未置位)第一次开总开关时,用一次
WriteConfiguredValues 批量写 13 键(总开关 + 11 规则全 true + 播种标记),
单文件原子写无部分失败态。标记置位后总开关任何翻动只写总开关一个键,
用户修剪过的选择在临时停用/恢复间原样保留。

播种信号靠持久化标记而不是「规则位全零」:用户故意全部取消勾选后位图
同样是零,无标记会把每次开启都误判成首次启用。fuzzy_seeded 是内部键,
设置快照不下发不展示;两份 toml 模板补键,缺键会被升级合并丢弃导致
老用户升级后误重播种。设置页勾选态由 host 处理 configUpdate 后重发的
configSnapshot 驱动,前端无播种逻辑。

新增首次播种用例(播种全开、修剪子集反复开关、重启保持、全取消后不
重播种);默认值三形态补标记断言;既有往返/门控/注入用例改走不门控
视图或规则键直设,避开播种路径保持用例意图纯净。
2026-09-13 09:33:14 +08:00
Jia Sui b807f50d69 feat(server): 模糊音增加总开关并在聚合 getter 门控
[input] 新增 fuzzy_pinyin 总开关,默认关;GetConfiguredFuzzyPinyinOptions
在总开关关时返回全零 options,规则位缓存保留,临时停用后重开立即恢复。
设置页快照改用不门控的规则位视图,总开关关闭时复选框仍展示已存勾选;
configUpdate 分发把精确分支 input.fuzzy_pinyin 排在 fuzzy_ 前缀分支之前。
注入用例改为带总开关的 A-B-A-B,新增门控与默认值断言。
2026-09-13 09:12:45 +08:00
Jia Sui feb7db6de4 feat(server): 模糊音规则接入配置与会话注入
- [input] 段新增 11 个平铺模糊音键(fuzzy_z_zh … fuzzy_uan_uang,默认全关),
  读取用固定键表驱动,键名即 FuzzyPinyinRule 枚举名小写,单一映射可评审;
  位掩码缓存 uint32,reload 先清零再按位合成
- GetConfiguredFuzzyPinyinOptions 合成引擎选项,SetConfiguredFuzzyPinyinRule
  按键写盘(未知名拒绝且不动位图), ApplyConfiguration 每键注入,
  全拼与双拼同路径生效,设置改动即时生效
- settings_app configSnapshot 补 11 字段,ApplyConfigUpdate 用 input.fuzzy_
  前缀分发;windows_webview2 死宿主不接线(InitWebviewSettingsWnd 零调用者)
- 测试:默认值三形态、逐键往返与 0x7ff 合成、未知键拒绝、
  全拼/双拼 zhang→zang 候选注入用例;开发模板同步 11 键
2026-09-13 08:35:25 +08:00
fanlusky 88a086a75b perf(build): Release 编译跳过重复 configure,只构建打包用的目标
本地打包每次都要等很久,其中编译这一段有两处纯粹的重复劳动。

Visual Studio 生成器把 ZERO_CHECK 接进了每个目标,CMakeLists.txt 变化时
构建会自己重新生成,所以已有 CMake 缓存时前置的 cmake --preset 不改变任何
结果,只是每个构建目录白等约 10 秒,三个目录就是 30 秒。改成缓存存在就跳过,
需要强制重跑(改了 preset、换了工具链)时传 -Reconfigure。

构建目标也从 ALL_BUILD 收窄到 MetasequoiaImeServer / MetasequoiaImeTsf。
原先会一并构建 MetasequoiaImeServerTests、test_webview_contract、
test_windows_ipc_contract,而 Prepare-PackageFiles.ps1 随后又把它们从包里
删掉。server 目标的依赖闭包已经覆盖 Watchdog、三个面板、Settings、
DictionaryReplay 和 OpenCC 词典,产物一个不少。要连测试一起构建(比如为了
跑 ctest)传 -Target ALL_BUILD,server/AGENTS.md 里的 ctest 段落已注明。

顺带给 cmake --build 加上 --parallel,真正有代码改动时也能并行。

无改动时的增量编译:TSF 18.0s -> 3.7s,Server 21.9s -> 10.9s。
CI 不受影响,它直接调 cmake,不经过这些脚本。
2026-09-13 03:56:40 +08:00
fanlusky eadcca9f1b fix(server): 候选窗贴边后不再随内容变化上下左右乱飘
候选窗一旦贴住屏幕右边缘,删字后右边缘就会离开边缘;靠近屏幕下边缘时,它有时
正常停在当前行上方,有时却盖住当前行的文字。两者是同一个病根:最终定位用的不是
候选卡片本身,或者压根没有重新定位。

D2D:PlaceAndShow 末尾的水平夹取用的是宿主窗口宽度。宿主带透明阴影内边距、向上
取整到 64px、而且打字过程中只增不减,于是卡片被这些余量整体推离右边缘;删字后过
大的宿主宽度被保留,卡片左边缘就被冻住。改成夹取不透明卡片,和紧随其后的垂直夹取
用同一条规则,透明宿主允许越过屏幕边缘。

WebView2:内容更新只走「重绘不重排」的两条路径,它们从不重做上下翻转判定,只是
(a) 用「MarginTop -= 高度差」这个累加器去粘住底边,(b) 交给
KeepCandidateCardInsideHostAndMonitor 夹取,而后者在卡片底边越过工作区下边界时
直接把卡片往上推。于是本来在光标下方勉强放得下的候选窗,一旦下一个键多出一行释义
变高,就被径直推到当前行文字上面。现在两条路径都改为用实际绘制出来的尺寸重新推导
锚点(ReanchorCandidateHostToPaintedCard)——翻转判定只能信这个高度——两个累加器
随之删除。

另有两处一致性修补:MarginLeft/MarginTop 超出宿主可用余量时改为平移宿主而不是截断,
截断会让卡片毫无理由地吸到宿主的另一端;翻转判定的下边界改用 coordinates.bottom -
edgePadPx,与下游所有夹取共用一条线,否则会判定「下方放得下」,再被 2 DIP 边距顶
回来压到文字上。

已知未处理:翻转时的行高仍是写死的 24 DIP,因为 IPC 只传了文本范围的 left 和
bottom,行高在 GetPhysicalTextAnchor 里就被丢掉了。宿主报出的行比 24 DIP 高时,
翻转后的卡片底边仍会压进那一行——但现在是稳定的偏低,不再忽上忽下。
2026-09-13 03:07:52 +08:00
fanlusky 426bb9d544 feat(server): WebView2 候选窗口支持滚轮翻页,并加上开关
PR #351 只给 D2D 候选窗口加了滚轮翻页,WebView2 后端还没有。

网页端只上报一个以 WHEEL_DELTA 为单位的原始 delta,notch 累加仍然
交给 CandidateWheel::ConsumeWheelDelta,两个宿主最终都汇聚到
WM_PAGE_CANDIDATE,翻页逻辑一份不重复。Chromium 的 wheelDeltaY 本身
就是 ±120/格,正是原生累加器期望的单位,deltaY 作标准回退。

同时把滚轮翻页做成可配置的 general.paging_mouse_wheel,默认关闭:
候选宿主是 NOACTIVATE 且从不获得焦点,滚轮只有在 Windows「当我悬停
在非活动窗口上方时滚动它们」开启时才会送达,无法无条件承诺,所以设为
opt-in,设置页里也写明了这个前提。开关只在 WM_PAGE_CANDIDATE 一处
判断;D2D 那边在 WM_MOUSEWHEEL 顶部提前返回 false,关闭时消息照旧
交给 DefWindowProc,与功能加入前一致。
2026-09-13 01:02:02 +08:00
Lu Fan(SonnyCalcr) 87158b2262 Merge pull request #351 from LilyCarry/feat/candwnd-mousewheel-paging
feat(server): support mouse wheel paging on candidate window (refs #81)
2026-09-13 00:38:00 +08:00
fanluskyandCarry 63eab2f88f refactor(server): 滚轮翻页复用键盘翻页逻辑并移出按键热路径
在 #351 的基础上收敛几处实现:

- CloseContextMenu 里新增的 hover 清理和 Present 原本无条件执行,而
  ShowFromGlobalState 和 Hide 每次按键都会调它。没有菜单时按键路径上会多出
  一次整屏重绘,画的还是更新前的旧场景。改为只在确实有 popup 要销毁时才做。
- 分页与动态扩充的逻辑从键盘路径复制了一份。抽成
  ExpandCandidatesKeepingPagePosition 和 MoveCandidatePage,键盘与滚轮共用。
- 每一格滚轮直接投一个任务,而每个任务都可能回引擎和用户词库。改为在队列里
  合并成 page_steps,一次快速滚动只重绘一次。
- 窗口层不再直接调 EnqueueCandidateUiAction,改为与其它候选窗动作一致,
  PostMessage 到宿主 WndProc(WM_PAGE_CANDIDATE)。EnqueueCandidateUiAction
  的序号校验随之恢复原样。
- 滚轮累加拆成纯函数 CandidateWheel::ConsumeWheelDelta 并补上单元测试;
  候选窗隐藏时忽略迟到的滚轮消息。

滚轮翻页仍然把页内高亮重置为首项,键盘翻页仍然保留原有的页内索引。

Co-authored-by: Carry <xu762556@outlook.com>
2026-09-13 00:16:18 +08:00
fanlusky e860eaab43 fix(server): 避免 WebView2 候选窗阴影被裁切 2026-09-12 23:50:31 +08:00
fanlusky c01327cc0b feat(server): 设置窗口关闭后先隐藏,十分钟后才真正退出
设置是独立进程,每次关闭都销毁窗口,于是每次打开都要重新建 WebView2 并等首屏
导航,冷启动的等待完整地落在用户那一侧。现在用户关闭窗口只隐藏,进程继续持有
已经导航完成的 WebView2,十分钟内重新打开直接显示,超时后才走原来的退出路径。

隐藏期间停掉 300ms 的配置轮询并把 controller 置为不可见,让页面被浏览器降频,
免得一个看不见的窗口白占 CPU。重新露面时在 CancelLinger 里对称地恢复,并调用
WM_ACTIVATE 早就接好、此前一直是空操作的 Resume()。

窗口隐藏时保留的那一帧会在下次打开时先显示出来,所以隐藏前要清掉标题栏按钮的
悬停高亮,复用 WM_SIZE 在最小化/还原时已经用的那个 helper。页面自己的关闭按钮
在点击时清,这里覆盖 Alt+F4、启动图关闭按钮等不经过页面的路径。顺带清掉本地的
g_maximize_button_hover:隐藏的窗口收不到 WM_NCMOUSELEAVE,那个标志会一直是脏
的,下次真的移进去时不再发 enter。

两个边界:

首帧之前被关掉直接真退出,不留半初始化的进程——那种进程重新打开时启动图已经
dismiss 过,用户会对着一个空窗口等。这条同时覆盖启动图自己的关闭按钮,它发的
也是 WM_CLOSE。

CloseSettingsApplication() 是 Ctrl+Shift+Alt+T 的终止通道,紧接着 Server 自己
也要退出。它原来发 WM_CLOSE,而 WM_CLOSE 现在只隐藏,会把设置进程留在 Server
之后,所以改发新的 kQuitSettings 直通真正的退出。

OpenSettingsApplication() 不再自己 ShowWindow,改为投 kActivateSettings 让设置
进程自己处理:在这边直接显示不会取消延迟退出定时器,窗口会在用户面前被销毁,
而且 SW_SHOWNORMAL 还会把之前最大化的窗口还原掉。
2026-09-12 22:48:31 +08:00
Carry 0fb8001022 feat(server): support mouse wheel paging on candidate window (fixes #81) 2026-09-12 19:46:24 +08:00
fanlusky 2717000084 fix(server): 候选窗右侧截断——去重的 show 不再让待应用的裁剪区失效
WebView2 后端下候选窗右边总是被竖切一刀,且多半切在最后一个候选上。

根因在 WndProcCandWindow:g_candidate_content_generation 在处理函数最顶
部无条件自增,早于下面的去重判断。IME 每次按键会投递两次 show,于是每一
次按键的时序都是:

  gen N   -> path=content-only,InflateCandWnd 带着捕获 gen N 的回调发出
             DOM 更新;
  gen N+1 -> 帧签名相同,走 path=dedup,什么都没画、什么都没排,但把计数
             器留在了 N+1;
  gen N 的 dom-callback 触发,发现 N != N+1,直接 return。

结果 SetWindowRgn 只会被完整的 FineTune 刷新,区域一直冻结在上一次
FineTune 量到的宽度上。后面的候选页一旦更宽,就会画到过期区域之外 —— 右
边缘的硬切;更窄时只是多出一块看不见的透明留白,所以这个 bug 时隐时现。

诊断日志(851 行)里的证据:path=content-only 18 次,dom-callback 世代
不匹配 18/18,clip-measure-submit / apply / drop 全为 0,ui-region 7 次且
全部来自 path=full-layout。区域算术本身在 7 个样本里都正确。

修复:去重分支把世代还回去(compare_exchange,仅在期间无人自增时生效),
因为一次去重的 show 什么都没画,DOM 里仍然正是那次在途测量对应的帧。上面
的 path=superseded 出于同样的原因在自增之前就返回。

顺带修掉同一个 bug 的另一半与它为何一直查不出来:

- 去掉 #msime-fast-layout 那张给 .container/.row-wrapper 强加
  white-space:nowrap!important 的样式表(并在应用外观时移除历史残留),
  它让卡片长过 --msime-max-width-dip 的上限,再被 overflow-x:hidden 从字
  中间切开;
- ApplyCandidateFrame 与测量脚本改用 max-content,不再写死 nowrap;
- 量测宽度纳入 scrollWidth,并把 rw/ow/sw/cw 一并回传;
- webview_utils.cpp 里被 #define 成空操作的 ui-measure 日志恢复,裁剪路径
  的静默 return 补上 clip-refresh-skip 一行 —— 正是这两处的沉默让「区域
  从不刷新」在日志里毫无痕迹。

新增的日志只记录数字、坐标与状态,不含任何用户输入或候选文本。

Release / Debug 构建通过,ctest -C Debug 2/2 通过,打包安装后人工验证不再截断。
2026-09-12 18:42:04 +08:00
fanlusky a8c10a63a6 feat(settings): add a restart-server button under the UI backend setting
界面渲染 only takes effect at Server startup, so the setting already told the
user to restart the IME process but offered no way to do it outside the
Ctrl+Shift+Alt+R developer shortcut. Add a 重启 button in the same section.

Settings runs in its own process, so the request travels the Aux pipe — the
supported cross-integrity control path the config notifications already use —
and the Server exits with the Watchdog restart code. The shortcut and the
button now share RestartServerProcess().
2026-09-12 16:41:13 +08:00
fanlusky aba4851f90 test: do not require a lattice sentence from the locked dictionaries
Whether a whole-sentence candidate is produced depends on which
dictionaries and local models are installed, so the CI product data
yields none and the presence requirement failed there.  Check the
canonical reading of whatever whole-sentence candidates do appear, and
assert the shuangpin-to-quanpin conversion unconditionally instead --
that conversion is the value the fix attaches to those candidates.
2026-09-12 16:01:42 +08:00
fanlusky e835e09c20 fix(engine): give whole-sentence fallback candidates a canonical pinyin
The Google-pinyin whole-sentence candidate is inserted at index 0 in both
quanpin and shuangpin, so it is what Space commits.  All four construction
sites built it without a canonical quanpin reading, so when it finished a
word-creation session update_creating_word_progress() had no reading to
join and can_store stayed false: the prefix plus the sentence went to the
host app but were never learned.

Carry the converted quanpin segmentation on those candidates, and extract
the early-return storage condition into a testable predicate.
2026-09-12 15:53:54 +08:00
fanlusky ad77865f67 fix(server): learn generated-sentence phrases and keep AI context
PR #344 restored the selected prefix in the committed text for Generated
candidates, but the special-candidate early-return branch still skips the
rest of the post-commit work in ProcessSelectionKey.

Two consequences remained:

- The composed phrase was never stored. Word creation persists through
  EnqueueStoreUserPhraseTask in the creating-word completion block, which
  sits after the early return. Committing "西" + the generated sentence
  "你好中国" displayed correctly but was never learned, so the same input
  had to be composed again every time.
- g_ai_context was not advanced, so text committed through this branch was
  missing from the context sent to the AI suggestion provider.

Store the phrase before returning, restricted to Generated candidates in an
active creating-word state. Both pinyin halves are canonical quanpin
(creating_word.pinyin is accumulated by append_canonical_pinyin, and the
lattice candidate carries the whole-sentence key in canonical_pinyin), so a
single "'" joins them. Syllable/han-character agreement is validated by
create_word_from_canonical_pinyin, which rejects a mismatch instead of
writing a bad row.

Append to the AI context as well. The prefix was already appended by its own
ProcessSelectionKey call on the normal path, so only the current segment is
added here. The trim logic is factored into AppendAiContext and shared with
the existing call site rather than duplicated.

Refs #261.
2026-09-12 15:34:11 +08:00
Ouchihao 2cf9cda89e fix(server): preserve selected prefix when committing generated candidates 2026-09-12 14:01:08 +08:00
fanlusky a7779d2b05 refactor(engine): 将 engine 从 submodule 内嵌为仓内一等组件
`vendor/MetasequoiaImeEngine` submodule 改为 `engine/` 目录,导入的是
product-lock.json 原本钉住的提交 c810d201,逐文件核对过 blob,因此这是一次
搬迁而不是引擎升级。引擎自己的嵌套 submodule(googlepinyinime-rev、utfcpp、
miniaudio)按各自 gitlink 一并展开,来源与提交见 engine/UPSTREAM.md。

Windows 专门化裁掉了不属于本产品的部分:whisper.cpp 与本地推理 provider、
macOS 示例宿主、整个 dictionary/ 建库流水线、上游 CI 与 release-please 配置。
词库仍按 product-lock.json 在构建时取发布产物。

引擎不再进 product-lock.json:没有 gitlink 就没有可比对的东西,锁里写一个上游
commit 等于宣称这棵树仍等于上游,而第一个 Windows 专门化改动落地时这句话就假了。
verify-contracts / verify-checkout 随之移除,verify-published 保留。

CI 与工具链:引擎源码并入根 scripts/format.sh(删掉引擎自己的那份,避免两套排除
列表分叉);引擎 voice.yml 里的 silero_vad.onnx 摘要校验移到本仓 lock job;
engine-bump-triage 工作流与其测试删除;gitsubmodule 的 dependabot 频率由 daily
改为 monthly。

README、README.en、AGENTS.md、CONTRIBUTING、docs/product-release.md 及各子目录
文档同步说明新的位置与边界。
2026-09-12 03:40:48 +08:00
fanlusky 54e5c68f94 refactor(server): clear the Server and test /W4 warnings
Most of them come from logging that is compiled out. The disabled DIAG_LOGF /
FANY_IPC_LOG* macros expanded to `((void)0)`, so every HRESULT and parameter
that exists only to be logged looked unreferenced (C4189/C4100). They now
expand to `((void)sizeof(DiscardLogArgs(__VA_ARGS__)))`: the arguments stay in
an unevaluated context, so nothing is computed and no side effect runs, but the
names count as used.

The rest:

- C4100: commented out the parameter names that are genuinely unused
  (WinMain's hPrevInstance/nCmdShow, AdjustWndPosition's hwnd/height, the
  WebView2 callbacks' sender, and the no-op logging sinks).
- C4189/C4101: removed the dead locals and the unused catch bindings left over
  with the log statements.
- C4244: made the DIP-to-pixel and int-to-float conversions explicit in
  globals.h, ime_windows.cpp and the menu placement.
- C4456: renamed the shadowing `hwnd` and `lock` locals.
- C4005: guarded the tests' `#define NOMINMAX` with #ifndef; the test targets
  already define it on the command line.

Release builds clean and ctest passes for the server, the tests and msimeui.
Warnings under vendor/ are untouched: those are submodules with their own
repositories.
2026-09-12 00:55:57 +08:00
古明四季 116a82d3b5 fix(installer): 保留升级时的自定义翻译配置 2026-09-11 23:25:37 +08:00
Jia Sui 753312f32c fix(server): RDP 会话中候选窗缩放跟随宿主应用实际渲染比例 2026-09-11 22:21:57 +08:00
Jia Sui bd7cf1114d fix(server): D2D 内置皮肤补齐 light 配色,对齐 WebView2 CSS
Signed-off-by: Jia Sui <jsfaint@gmail.com>
2026-09-11 22:19:24 +08:00
Jia Sui 1ae63ad13f fix(server): D2D 候选窗明暗主题跟随设定与系统切换实时刷新
ApplySkin 的指纹缓存只含 theme_cand 原始值,follow 之下改 theme_mode
或系统明暗切换时指纹不变,候选窗停留在首次渲染的暗色 token。
把 ResolveConfiguredTheme 的解析结果并入指纹,让明暗变化穿透缓存。

同时补上系统明暗切换的实时刷新路径:WM_SETTINGCHANGE(ImmersiveColorSet)
时候选窗可见则重绘、常驻的悬浮工具栏即时 ApplyTheme;托盘菜单每次
打开已先 ApplyTheme,无需处理。
2026-09-11 22:19:24 +08:00
Neptrue_Lin 972cf729c9 Merge pull request #326 from ouchihao/codex/fix-298-numpad-punctuation
fix(windows): commit highlighted candidates with numpad punctuation
2026-09-11 20:18:16 +08:00
Neptrue_Lin 3eb82c7878 Merge branch 'develop' into feat/issue-234-rime-dict-import 2026-09-11 20:06:16 +08:00
Ouchihao 1d2431add6 fix(windows): commit highlighted candidates with numpad punctuation 2026-09-11 19:32:17 +08:00
fanlusky 73ec6fe9c9 perf(ci): cache the Server MSVC build with sccache
The Server job's Build step dominates the pipeline (~6m37s of a ~9.5m job;
the dictionary/integration test is only ~43s). sccache caches individual
MSVC compiles across runs so an incremental change rebuilds only what it
touched instead of the whole server + engine tree.

sccache only caches an MSVC compile whose debug info is embedded in the
object, so switch the Server build's Release debug info from /Zi to /Z7.
The linker's /DEBUG still emits the beside-the-executable PDB the release
job validates, so the symbol layout is unchanged.

Its compiler-launcher hook is honoured only by the Ninja and Makefile
generators, so configure the Server build with Ninja Multi-Config (keeping
the --config Release / bin/Release layout the later steps depend on) and
add an MSVC-environment step, since Ninja does not locate cl.exe on its own.
2026-09-11 03:46:30 +08:00
Lu Fan(SonnyCalcr) 0eaa35eed1 Merge pull request #274 from linyanm/fix/issue-155-settings-lag
fix(server,ui-html): 降低设置窗口拖动与工具栏首屏卡顿
2026-09-10 21:33:31 +08:00
fanlusky 9447881c54 Merge branch 'develop' into fix/dictionary-replay-non-ascii-path
Conflict resolutions:

* windows/src/Utils/FanyUtils.h -- develop deleted GetIMEDataDirPath too
  (via #273), so both sides had identical content and the whole-file
  conflict was only develop's .gitattributes LF normalisation. Took
  develop's version; the symbol is now gone repo-wide.

* server/src/skin/candidate_skin_catalog.cpp -- #273 landed the same
  wide-path manifest read on develop. Took develop's code verbatim so
  this hunk is a no-op against develop, keeping only the comment that
  explains why toml::parse_file(manifest.string()) is unusable here.

* server/tests/src/test_quanpin_scheme.cpp (x2) -- union: this branch's
  test::Utf8(db_path) plus develop's `both` autocorrect-flag local.

Verified: server Release build clean, 282 tests pass.
2026-09-10 20:50:17 +08:00
fanlusky 093b485124 Merge branch 'develop' into fix/issue-242-settings-cannot-save
冲突解决:

- windows/src/Utils/FanyUtils.h:develop 通过新增的 .gitattributes 把整个文件
  从 CRLF 规范化成 LF,与本分支删除 GetIMEDataDirPath() 声明的改动整文件冲突。
  取 develop 的 LF 版本,再删掉该声明。
- server/tests/src/test_config_non_ascii_path.cpp:仅 include 块冲突,取两侧并集
  (algorithm/filesystem/fstream/iterator/string/system_error)。另修正一处错误的
  自动合并——develop 新增的候选回退字体断言本属于
  config_round_trips_under_non_ascii_profile_path,git 却按上下文并进了本分支新增的
  config_migrates_legacy_acp_mangled_path,已移回原测试。
2026-09-10 19:33:43 +08:00
Lu Fan(SonnyCalcr) 184444cf7f Merge pull request #272 from linyanm/fix/issue-267-d2d-toolbar-size
fix(server): 设置变更时重建 D2D 悬浮工具栏外观
2026-09-10 19:18:07 +08:00
Jia Sui fe7b4ab37d fix(server): 修复 test_quanpin_scheme 在 CI MSVC 下编译失败
- 跨不同长度数组的初始化列表推导不出共同指针类型(C3535):改为边界对
  + lambda 遍历,语义与原双表循环一致
- QuanpinAutocorrectCutRejectsInputsOutOfScope 引用了另一用例的局部 none:
  改为字面量 0u
- 根因:本地验证时构建失败被日志截断掩盖,ctest 跑了陈旧二进制给出假绿;
  已改为显式检查构建退出码并确认测试用例进入二进制
2026-09-10 17:42:55 +08:00
Jia Sui 2fcd57c88d style(server): 全拼纠错相关代码过 scripts/format.sh
- 生成脚本 Count 行模板改为单行,与 clang-format 输出一致,
  生成器 --check 与 format.sh --check 从此不再互斥
- test_quanpin_scheme 格式化
2026-09-10 17:32:17 +08:00
Jia Sui f8f13e7083 feat(server): 全拼纠错分类开关配置接线与候选标记
- 配置拆为 quanpin.autocorrect_transposition/neighbor 平铺键(默认关),
  旧键 autocorrect 废弃不读取不迁移;写入时段缺失自动追加,
  出厂模板无 [quanpin] 段时设置页保存不再静默失败
- engine_input_session 用 Engine 命名常量合成位掩码注入
- settings_app 补 configSnapshot quanpin 段与 ApplyConfigUpdate 路由
- BuildCurrentCandidatePage 按 corrected_from 给 view.text 追加纠错标记,
  msimeui 与 WebView2 两渲染路径共同源单点注入,提交/词频路径不受污染
- 生成脚本 add_variant 键长下限 2→3(2 字母空间归简拼),重建表 747+3244
- 测试:AC9 配置往返与旧键忽略、开关矩阵适配新签名、守卫用例
2026-09-10 17:31:51 +08:00
Neptrue_Lin ff7650bba2 Merge pull request #293 from Aegon8719/feat/issue-55-fallback-fonts
issue-55 候选窗支持可配置的有序回落字体
2026-09-10 17:14:29 +08:00
Aegon 8a78b02271 Merge branch 'develop' into feat/issue-52-shortcuts 2026-09-09 18:18:21 +08:00
Aegon8719 dea9292814 issue-55 候选窗支持可配置的有序回落字体 2026-09-09 18:03:56 +08:00
Aegon8719 848cf6a288 issue-288 修复候选窗在光标坐标无效时提前显示的问题 2026-09-09 11:40:26 +08:00
fanlusky ac8394291b fix(tests): keep the shared test header free of engine dependencies
The portable test target builds on a bare Linux runner with no vcpkg tree, so
the UTF-8 path helper cannot live in test_framework.h -- including the engine's
data_path.h there broke the sanitizer build. Move it to test_utf8_path.h, which
only the Windows tests that need it include.
2026-09-09 04:48:56 +08:00
fanlusky 55605973d8 fix: build filesystem paths as UTF-8, not through the ANSI code page
Narrow strings in this repo are UTF-8, but std::filesystem converts narrow
strings through the system ANSI code page. The two agree only on ASCII, so any
path crossing that boundary breaks for users whose profile directory is not
ASCII -- and on a code page that cannot represent the characters at all,
path::string() throws rather than mangling.

The user dictionary replay tool hit exactly that. It handed the journal API
paths converted with path::string(); on a Chinese user name the conversion
threw, the exception escaped main(), and MSVC fastfailed the process with
0xC0000409. The installer treats any non-zero exit from replay as fatal, by
design, so those users could not upgrade at all. Build the paths from the wide
form via path_from_utf8/path_to_utf8 instead, and wrap main() so an unexpected
failure reports a diagnosable message and exit 1 rather than a fastfail code.

The skin catalog had the same defect: toml::parse_file(manifest.string())
routed the manifest path through the ANSI code page, and skins live under the
user profile. The throw escaped past the toml handlers around it. Read the file
through the wide path and parse the text instead.

Also drop FanyUtils::GetIMEDataDirPath, which built a path from the ANSI
environment block and dereferenced getenv without a null check. It had no
callers.

Tests cover the three layers this spans: the conversion contract itself, the
journal API in-process, the replay tool as the installer actually launches it,
and the skin catalog. Each non-ASCII case is paired with an ASCII control so a
failure says whether the path encoding or the data caused it. The replay and
skin tests were both confirmed to fail with their fix reverted.

Test fixtures pass paths through the new test::Utf8 helper rather than
path::string(), since the temp directory sits inside the user profile too.
2026-09-09 04:35:34 +08:00
fanlusky 28689361ad fix(ci): unblock packaging on the self-hosted runners
Two independent failures kept the v0.6.5 installer from being built after
the pipe probe was fixed.

The package job died in "Verify the release commit is on main" with git
exiting 128 on dubious ownership: runner instance 2 leaves _work owned by
SYSTEM while the job runs as `runner`. actions/checkout is unaffected, so
the first plain git call is what fails, and only jobs scheduled onto that
instance see it. Mark the workspace as safe in the three self-hosted jobs.

Neither vcpkg manifest carried a builtin-baseline, so vcpkg resolved ports
against the registry at HEAD and every build depended on a live fetch of
microsoft/vcpkg. When that fetch degraded, the ports simply vanished:

    Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...
    fmt does not exist
    utfcpp does not exist

Build TSF x64 failed this way twice and passed twice on the same runner,
which is what an unpinned registry looks like. Pin both manifests to
04a9d8e5, the commit vcpkg-lock.json already records as resolved.
2026-09-09 02:18:57 +08:00
fanlusky 0e003fa095 perf(server): time each segment of the per-keystroke candidate build
PrepareCandidateList runs on the shared task thread, so a stall inside it
delays the hide/show messages queued behind it and reaches the screen as
candidate-window flicker. The diagnostic log showed an identical workload
take 8 ms once and 688 ms moments later, but not which segment paid for it.

Split the function into measured segments and emit one "candidate build"
line per keystroke, separating the engine candidate lookup from the
user-dictionary fixed-position pass -- the latter opens a SQLite
connection and runs its schema DDL on every call.

Measurement only; no behaviour change.
2026-09-08 22:53:59 +08:00
fanlusky bb53763e66 fix(server): only grace-delay a candidate hide the worker delivered late
The unconditional 50ms hide grace cost typing its snap: every commit left the
candidate window up for an extra frame or three, and when the next word started
inside the window the pending hide was cancelled outright, so the box stopped
disappearing between words and just morphed instead.

Only a hide that waited behind a stalled task thread can describe state the user
has already typed past, and only that one has a show queued behind it worth
waiting for. Measure the queue wait where the task is dispatched and mark the
posted message; normal typing never reaches the threshold, so it hides
immediately exactly as before.

The wait is now logged per hide task, so the threshold can be checked against a
real capture rather than assumed.
2026-09-08 22:53:59 +08:00
fanlusky cc81f794bb fix(server): stop candidate strobing when the worker queue backs up
Diagnostic logs from a busy machine show the candidate host repainting far
more often than the input changes. Three separate causes, all in the UI
thread's handling of the worker's posted messages:

- A HideCandidate for one keystroke of a burst (backspacing the composition
  empty, then typing again) cloaks a visible window and un-cloaks it ~30ms
  later. Defer the hide on a short grace timer and drop it when a show
  arrives first; a real commit or focus loss still hides, 50ms later.
- Each keystroke posts two WM_SHOW_MAIN_WINDOW messages, since the candidate
  rebuild and the English/cloud merge both request a show. Skip a repaint
  whose preedit, page, selection and caret match the frame already on screen
  within a short window.
- When the worker stalls it drains several keystrokes at once and posts a
  show for each. The handler always renders the newest published state, so an
  older queued show can only repaint what the newer one is about to; drop it
  when a newer show is already queued.

The stall itself (PrepareCandidateList blocking the shared task thread, worst
case 688ms against a median of 11ms) is untouched here.
2026-09-08 22:53:59 +08:00
linym c07aa8e878 fix(server,ui-html): 降低设置窗口激活卡顿 (#155)
激活时不再重推整份配置;HTML 按 UTF-8 二进制读取;契约脚本移到标记之后;最大化按钮矩形用 rAF 合并。
2026-09-08 22:47:26 +08:00
linym 075fbb2a84 fix(server): persist settings after leftover non-ASCII config paths
Elevated setup left high-IL config.toml that medium-IL Settings never
rewrote on machines hit by the ANSI path bug. Make the data directory
writable, migrate ACP-mangled leftovers, rebuild unparseable files, and
keep remaining asset paths on wchar_t.

Fixes #242
2026-09-08 22:42:26 +08:00
linym f588b7f5e8 fix(server): rebuild D2D toolbar when scale or icon size changes
D2D bakes user scale into Visuals at RebuildScene. RelayoutHost alone left the live toolbar unchanged after settings updates.
2026-09-08 22:26:31 +08:00
linyanmandlinym 6e03f57747 fix(server): 全拼导入按汉字数选择切分并识别文件编码 (#270)
无分隔拼音按汉字数另选完整切分,避免西安/xian 误报音节数不一致。设置页按 BOM 识别 UTF-8/UTF-16,无效 UTF-8 再回退 GBK。带撇号的水杉导出三列 TSV 本身已合法,回归测试钉住该格式。

Co-authored-by: linym <lin.yanming@foxmail.com>
2026-09-08 22:52:45 +09:00
linym 2776e157b0 style(server): wrap dictionary import test to satisfy clang-format 2026-09-08 20:58:57 +08:00
linym 28a0c03500 feat(server): 批量导入兼容 Rime userdb.txt 与 dict.yaml 2026-09-08 20:45:14 +08:00