Skip to content

feat: better IME 支持 (add preedit & commit event)#622

Open
Milk-COCO wants to merge 4 commits intonot-fl3:masterfrom
Milk-COCO:master
Open

feat: better IME 支持 (add preedit & commit event)#622
Milk-COCO wants to merge 4 commits intonot-fl3:masterfrom
Milk-COCO:master

Conversation

@Milk-COCO
Copy link
Copy Markdown

@Milk-COCO Milk-COCO commented Apr 18, 2026

更好地处理ime input!!
Better handling ime!!

我期望在所有平台上都支持这玩意,,
I expect this foobar to be supported on all platforms.

主要功能 / Main Feature

  • on_ime_preedit() 回调,可以在用户确认前实时显示正在输入的文本(如拼音串)。
    on_ime_preedit() callback. The text being inputted (such as pinyin strings) can be displayed immediately before the user confirms.

  • on_ime_commit() 回调,传递选定的最终确定的字符串。
    on_ime_commit() callback. Pass the selected and finalized string.
    Such as:vault-macroquad/lib.rs

  • 隐藏掉windows显示的那个丑陋的默认输入框,且在ime没开启时无法切换到非英文输入法。
    Hide Windows's ugly default input box , and let cannot switch to non English input methods when ime is not enabled.

Tips

仅针对 Windows 平台!Linux (X11/Wayland) 和 macOS 的 is TODO!!
Windows only! (Linux (X11/Wayland) & macOS) 's is TODO!!

要更好地使用预编辑,需要在有预编辑文本时,在类似于key_up_event的回调内拦截输入以避免重复触发。
To use preedit better, it is necessary to intercept input within a callback similar to key_up_event() when there is some preedit text, to avoid repeated triggering.

例子 / Example

已在 Windows 10 上使用微软拼音测试
Tested with Microsoft Pinyin on Windows 10

且我只测了这一个输入法的中文输入所以肯定有很多bug!
And I only tested the Chinese input of this input method, so there must be many bugs!

纯macroquad(超级魔改版的)输入框的示例:vault-macroquad/examples/flow_textinp.rs
Example of a pure (super modded) Macroquad input box is at upper

(悄悄告诉你我还在这个repo里面写了独立的ui和事件系统)
(Secretly telling you, I also wrote another UI and event system in this repo)

i know it's feat but not fit TwT

@Milk-COCO
Copy link
Copy Markdown
Author

oh shit I can't even switch Chinese ime
hold on

@Milk-COCO Milk-COCO changed the title feat: Windows下 better IME 支持 (add preedit & commit event) feat: better IME 支持 (add preedit & commit event) Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant