-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Japanese IME input mode switched back to Direct Input after pressing Enter key #13398
Comments
Might be related: #12731 |
If we can't have a smarter way to detect when should we use compose mode and when should we use direct input, I would like to have an option to disable this behavior. Since I already installed a separate English (US) language along side Chinese (Simplified, MS Pinyin) so that I can turn off IME for good if I don't need it. |
At least MS Pinyin handles it this way with conhost: On first start of conhost, uses direct input by default. |
I have encountered this issue, and it never occurred in previous versions. When I write a git commit message mixed in English(alphabet) and Japanese, I often commit unintentional messages. (and have to amend commit again...) Best regards. |
It's indeed related as the problem occurred after upgrading to v1.14.1432. Hope that there is a way to disable this behavior, because I tend to press enter key to end IME composition. |
I also have the same problem. When I type Chinese, then I press enter it jumps to English IME. |
This problem does not occur with Google Japanese Input. |
I'm having the same problem with MS-IME on Windows Terminal version 1.14.1963.0. |
It didn't work for me. Does someone know other work-arounds? |
If finalize with You could write following AutoHotKey script based on the hack.
|
I'm running into the same issue. In my environment, I can avoid the issue by waiting 0.5 - 1.0 seconds before pushing |
I also have the same problem.
ty. |
I wonder if there's a way to only request AlphanumericHalfWidth the very first time the IME opens for a pane, and then just continue using the previously used mode for subsequent invocations. @YanceyChiew as an FYI. I'm not as familiar with the intricacies of the IME APIs, so you might have some better ideas here. Link for future me: #13028 |
In short, yes, there is. This is the default behavior for Chinese input, so I thought there was no need for additional processing, but I didn't expect it to cause trouble for Japanese input method users. The root of the problem lies in these few lines of code: void TSFInputControl::ClearBuffer()
{
if (!_inputBuffer.empty())
{
TextBlock().Text(L"");
const auto bufLen = ::base::ClampedNumeric<int32_t>(_inputBuffer.length());
_inputBuffer.clear();
_editContext.NotifyFocusLeave();
_editContext.NotifyTextChanged({ 0, bufLen }, 0, { 0, 0 });
_editContext.NotifyFocusEnter();
_activeTextStart = 0;
_inComposition = false;
}
} It can be seen that this code will not perform any effective operation when Maybe it is because the Microsoft Japanese input method is in the English (direct) input mode by default, and it's handling of lost input focus is also different from the Chinese input method, after each call to Incidentally, in another issue(#1304), someone wanted such a feature, but I found it difficult to implement cleanly. (ps. When using the old Japanese input method, it will exit to direct input mode when pressing enter only when there are no characters in the input buffer of composition mode, so only newlines will cause composition mode to exit uncontrollably.) The easiest solution I can think of is to modify the But in this project, I haven't found a suitable place to insert that line of code yet. It can also be inserted in the code block quoted above, |
It seems you are right. I changed the line at at src/cascadia/TerminalControl/TSFInputControl.cpp:43
to
I agree with what you tried to do with your PR #13028, P.S. |
This may be because |
So, the question now is, use the simple solution to change the Both methods can solve the current problem, If we choose the former, since it cannot be assumed that the window is initialized with input focus, the code may have to be inserted before Insert code here and it will be repeated every time the window regains focus, not every time enter is pressed. void TSFInputControl::NotifyFocusEnter()
{
if (_editContext != nullptr)
{
_editContext.NotifyFocusEnter();
_focused = true;
// CODE INSERT HERE
// _editContext.InputScope(CoreTextInputScope::Text);
}
}
If we choose the latter, do we need to expose the option to the settings page in the gui, and have the default value determined by the user's system locale? |
I think we should wait a while for other reports. I'd like to vote for "add a setting". And "Set default values determined by the user's system locale" is a good idea. With this, most people will not need to change this setting, so it seems to me that there is no problem even if editing the json is the only way to change this setting. (of course, it would be nice to have a gui) |
I believe the easiest fix is to remove the calls to |
While working on microsoft#13398 I felt that `TSFInputControl` wasn't up to sniff. This commit is a minor cleanup of the class: * default member initializers * Simplified use of STL classes which already perform boundary checks * Correctly check text buffer emptiness in `_SendAndClearText` * Track selection range as mandated by the API ## Validation Steps Performed * Japanese IME (Full-Width Katakana) Typing "saitama" produces "サイタマ" ✅ * Korean IME Typing "gksrmf" produces "한글" ✅ * Vietnamese IME Typing "xin chaof" continues to produce broken "xin xinchaof" (It's supposed to produce "xin chào") * Emoji Picker (Win+.) ✅
🎉This issue was addressed in #13678, which has now been successfully released as Handy links: |
I'm sorry for bringing this up again. I don't have other CJK languages installed, so it might happen with the Japanese MS IME only. Also, I believe that the new behavior is causing |
While working on microsoft#13398 I felt that `TSFInputControl` wasn't up to sniff. This commit is a minor cleanup of the class: * default member initializers * Simplified use of STL classes which already perform boundary checks * Correctly check text buffer emptiness in `_SendAndClearText` * Track selection range as mandated by the API ## Validation Steps Performed * Japanese IME (Full-Width Katakana) Typing "saitama" produces "サイタマ" ✅ * Korean IME Typing "gksrmf" produces "한글" ✅ * Vietnamese IME Typing "xin chaof" continues to produce broken "xin xinchaof" (It's supposed to produce "xin chào") * Emoji Picker (Win+.) ✅ (cherry picked from commit 2c922e1) Service-Card-Id: 85034073 Service-Version: 1.15
This commit builds directly on the changes made in microsoft#13677 and fixes: * TSF resetting to AlphaNumeric ("ASCII") input mode when pressing enter * Vietnamese IME not composing a new word after pressing whitespace, etc. Closes microsoft#11479 Closes microsoft#13398 ## Validation Steps Performed * Japanese IME (Full-Width Katakana) Typing "saitama" produces "サイタマ" ✅ * Korean IME Typing "gksrmf" produces "한글" ✅ * Vietnamese IME Typing "xin chaof" produces "xin chào" ✅ * Emoji Picker (Win+.) ✅ (cherry picked from commit ed800dc) Service-Card-Id: 84832470 Service-Version: 1.15
Windows Terminal version
1.14.1451.0
Windows build number
10.0.19044.1766
Other Software
No response
Steps to reproduce
Expected Behavior
The input mode should not switch back to Direct Input
Actual Behavior
The input mode switched to Direct Input automatically after conversion
The text was updated successfully, but these errors were encountered: