-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adjust the position of the input method window so that it follows the caret #431
base: master
Are you sure you want to change the base?
adjust the position of the input method window so that it follows the caret #431
Conversation
…t follows the caret.
Can you explain a bit more? I have some concerns about the code changes. Thank you! |
…t follows the caret.
程序使用输入法输入文字时必须告诉系统输入法窗口应该显示在哪里 大体流程是监听窗体的键盘消息识别出输入法的虚拟键码VK_PROCESSKEY,然后在basic_text_box::key中识别到这个键码,计算出插入位置的坐标,然后获取窗体的输入法上下文,设置输入法的候选框和合成框的位置。 根据之前的代码,VK_PROCESSKEY 会被识别成 key_code::unknown,后续不会进入“basic_text_box::key”中,变更后会进入“basic_text_box::key”中,确实会对之前的代码流程产生影响,不过 VK_PROCESSKEY 本身不会导致输入位置发生变化,因此不会产生实际影响。另外枚举key_code::ime_process_key设置为-2可能也不是很合适。 总之这里仅是提供一个思路,你可以对代码做出合适的调整 Below is the AI translation: When the program uses an input method to enter text, it must tell the system where the input method window should be displayed. The process involves monitoring the keyboard messages of the window to identify the virtual key code VK_PROCESSKEY of the input method. Then, in “basic_text_box::key” , recognize this key code, calculate the coordinates of the insertion point, obtain the input context of the window, and set the position of the input method's candidate window and composition window. Based on the previous code, VK_PROCESSKEY would be recognized as key_code::unknown, and subsequently, it would not enter basic_text_box::key. After the change, it will enter basic_text_box::key. This indeed affects the previous code flow. However, VK_PROCESSKEY itself does not cause the input position to change, so there should be no practical impact. Additionally, setting key_code::ime_process_key to -2 may not be entirely appropriate. In summary, this is just a suggestion, and you can make suitable adjustments to the code. |
Thank you for your contribution. I appreciate it! Is it possible to move all platform-specific (Windows) code to Also, how about Linux and MacOS? |
yes, I will make some adjustments to the code later. And I tested the Linux platform and found that the input method cannot be invoked, this issue likely applies to Japanese and Korean input as well.There are several input method frameworks on Linux, so corresponding adaptations will likely be needed. |
Wonderful! Let's keep this open. I want to merge this when it becomes mature and can support all supported OSes. |
before
after