Feature Request: IME mode after pressing Escape or Enter key in CJK input #1729

Closed
opened 2026-01-30 22:34:51 +00:00 by claunia · 21 comments
Owner

Originally created by @qqkookie on GitHub (Jun 18, 2019).

Originally assigned to: @DHowett on GitHub.

When CJK input method (IME) is used, pressing Escape key or Enter key will restore IME mode to ALPHA input mode. Keeping CJK mode in command line input after these keys causes mostly erroneous input. This behavior may be per-user configurable option.

Originally created by @qqkookie on GitHub (Jun 18, 2019). Originally assigned to: @DHowett on GitHub. When CJK input method (IME) is used, pressing <B>Escape</B> key or <B>Enter</B> key will restore IME mode to ALPHA input mode. Keeping CJK mode in command line input after these keys causes mostly erroneous input. This behavior may be per-user configurable option.
Author
Owner

@zadjii-msft commented on GitHub (Jun 18, 2019):

@qqkookie is this for the Windows Terminal, or conhost.exe (which is the window for cmd.exe, powershell, wsl.exe, etc.)?

@zadjii-msft commented on GitHub (Jun 18, 2019): @qqkookie is this for the Windows Terminal, or conhost.exe (which is the window for cmd.exe, powershell, wsl.exe, etc.)?
Author
Owner

@qqkookie commented on GitHub (Jun 19, 2019):

For Window Terminal. I have implemented similar feature for Cygwin / mintty. You can see my implementation in c7fb70e743

Many CJK terminal emulators (SSH/Telnet clients) on MS Windows have similar feature. For example, Korean iPuTTY (open source), XShell (commercial SSH client) and many X window Korean/Hanguel terminal emulator like hanterm. It is such universally requested feature for Korean terminal users.

@qqkookie commented on GitHub (Jun 19, 2019): For Window Terminal. I have implemented similar feature for Cygwin / mintty. You can see my implementation in https://github.com/qqkookie/mintty/commit/c7fb70e7431e8e1c0a00cfcff783909194a9a162 Many CJK terminal emulators (SSH/Telnet clients) on MS Windows have similar feature. For example, Korean iPuTTY (open source), XShell (commercial SSH client) and many X window Korean/Hanguel terminal emulator like hanterm. It is such universally requested feature for Korean terminal users.
Author
Owner

@qqkookie commented on GitHub (Nov 12, 2019):

I examined current source myself. It seems that CJK IME is handled by console host. ConHost/Host/{ input.c and conimeinfo.c_. I guess that the HandleKeyEvent() routine in $(ROOT)/src/interactivity/win32/windowio.cpp is suitable place to handle this feature.

Insert code like below in the HandleKeyEvent() function.

if ((key == VK_RETURN || key == VK_ESCAPE) && !mods) {
    HIMC hImc = ImmGetContext(wnd);
    if (ImmGetOpenStatus(hImc)) {
      ImmSetConversionStatus(hImc, IME_CMODE_ALPHANUMERIC, IME_SMODE_NONE);
      ImmReleaseContext(wnd, hImc);
    };
  };
@qqkookie commented on GitHub (Nov 12, 2019): I examined current source myself. It seems that CJK IME is handled by console host. ConHost/Host/{ input.c and conimeinfo.c_. I guess that the HandleKeyEvent() routine in $(ROOT)/src/interactivity/win32/windowio.cpp is suitable place to handle this feature. Insert code like below in the HandleKeyEvent() function. <PRE> if ((key == VK_RETURN || key == VK_ESCAPE) && !mods) { HIMC hImc = ImmGetContext(wnd); if (ImmGetOpenStatus(hImc)) { ImmSetConversionStatus(hImc, IME_CMODE_ALPHANUMERIC, IME_SMODE_NONE); ImmReleaseContext(wnd, hImc); }; }; </PRE>
Author
Owner

@zadjii-msft commented on GitHub (Nov 12, 2019):

@qqkookie great work finding that in the code. However, what you've found there is the code that is responsible for conhost.exe's IME handling. conhost.exe is the vintage console window, and it's not really accepting new feature PRs like that.

Unfortunately, with #2213, the IME in the Windows Terminal doesn't currently work. There's a PR in progress for it in #1919. Once that's in, then it might be more appropriate to investigate this feature for the Windows Terminal 😊

@zadjii-msft commented on GitHub (Nov 12, 2019): @qqkookie great work finding that in the code. However, what you've found there is the code that is responsible for `conhost.exe`'s IME handling. `conhost.exe` is the vintage console window, and it's not really accepting new feature PRs like that. Unfortunately, with #2213, the IME in the Windows Terminal doesn't currently work. There's a PR in progress for it in #1919. Once that's in, then it might be more appropriate to investigate this feature for the Windows Terminal 😊
Author
Owner

@DHowett-MSFT commented on GitHub (May 7, 2020):

From @eromoe:

@DHowett-MSFT How is going on ? This problem still exists in 0.11 . We usually open a terminal type some command then close it , this problem is very annoying .

Let me express again:

  1. Most people type english in terminal
  2. Terminal automatically enable input method(not prime, it is second one) at startup , no other softwares do this .
  3. Terminal automatically enable a broken input method , which behaviour is different from the original input metod, mainly lost words select box. Need quit input method , enter again to gain words select box , see below gif :

tm

@DHowett-MSFT commented on GitHub (May 7, 2020): From @eromoe: > @DHowett-MSFT How is going on ? This problem still exists in 0.11 . We usually open a terminal type some command then close it , this problem is very annoying . > > Let me express again: > 1. Most people type english in terminal > 2. Terminal automatically enable `input method`(not prime, it is second one) at startup , no other softwares do this . > 3. Terminal automatically enable a broken `input method` , which behaviour is different from the original input metod, mainly lost words select box. Need quit input method , enter again to gain words select box , see below gif : > > ![tm](https://user-images.githubusercontent.com/3938751/80167952-4ac34300-8614-11ea-84e8-5bb9cd3e893b.gif)
Author
Owner

@DHowett-MSFT commented on GitHub (May 7, 2020):

I've looked high and low at CoreTextEditContext, and I just can't find the equivalent API for ImmSetConversionStatus. Have to ask our input folks.

@DHowett-MSFT commented on GitHub (May 7, 2020): I've looked high and low at CoreTextEditContext, and I just can't find the equivalent API for ImmSetConversionStatus. Have to ask our input folks.
Author
Owner

@cmplstofB commented on GitHub (Oct 6, 2020):

There is another method that use control sequence. For example, some terminal software that connects to a Unix terminal from Windows, such as RLogin and Tera Term, can control IME by extended CSI Sequence.

Control Sequence (Name) Function
CSI < s (TTIMESV) Save IME open state.
CSI < r (TTIMERS) Restore IME open state.
CSI < Ps t (TTIMEST) PsPs=1: Close IME, Ps=0: Open IME.

By making the Windows Terminal compatible with these control sequences, users can freely change the IME settings.
For example, users can disable the IME when logging in to the shell, or respect outside IME settings at the insert mode of Vim.

@cmplstofB commented on GitHub (Oct 6, 2020): There is another method that use control sequence. For example, some terminal software that connects to a Unix terminal from Windows, such as [RLogin](https://kmiya-culti.github.io/RLogin/) and [Tera Term](https://ttssh2.osdn.jp/index.html.en), can control IME by extended CSI Sequence. Control Sequence (Name) | Function --------------------|----------- <kbd>CSI < s</kbd> (`TTIMESV`) | Save IME open state. <kbd>CSI < r</kbd> (`TTIMERS`) | Restore IME open state. <kbd>CSI < <var>Ps</var> t</kbd> (`TTIMEST`) | Ps<var>Ps</var>=1: Close IME, <var>Ps</var>=0: Open IME. * https://ttssh2.osdn.jp/manual/4/en/about/ctrlseq.html * https://kmiya-culti.github.io/RLogin/ctrlcode.html By making the Windows Terminal compatible with these control sequences, users can freely change the IME settings. For example, users can disable the IME when logging in to the shell, or respect outside IME settings at the insert mode of Vim.
Author
Owner

@Refactoring commented on GitHub (Oct 8, 2020):

@qqkookie @DHowett
This problem is basically the default settings of garbage chinese input tool(For example, 搜狗输入法). My English is too bad, I'd Chinese describe it. Anyway, this problem is Chinese users will have.

安装完操作系统后,大多数人都会使用类似搜狗输入法这样的第三方的输入法工具(后续讲解以搜狗简称), 并且删除系统中自带的微软拼音、五笔输入法。因为操作系统只有一个语言"中文",所以此时只会存在一个输入法,即搜狗。同时因为Win10操作系统的原因,系统不会添加一个默认的英文输入法。 所以这时候所有程序进入后,输入法全是搜狗。

解决方法:
在搜狗输入法的状态栏中,鼠标右键,打开"输入法管理", 点击"添加输入法",添加一个输入语言为"英语(美国)",输入法为"US"的输入法(不要添加"中文(简体,中国)","US"输入法,这个输入法会出现上面Gif中的问题)。 添加成功后,将其"设为默认"(切记设置,因为垃圾搜狗将搜狗输入法设置为默认输入法)。

@Refactoring commented on GitHub (Oct 8, 2020): @qqkookie @DHowett This problem is basically the default settings of garbage chinese input tool(For example, 搜狗输入法). My English is too bad, I'd Chinese describe it. Anyway, this problem is Chinese users will have. 安装完操作系统后,大多数人都会使用类似**搜狗输入法**这样的第三方的输入法工具(后续讲解以**搜狗**简称), 并且删除系统中自带的微软拼音、五笔输入法。因为操作系统只有一个语言"中文",所以此时只会存在一个输入法,即搜狗。同时因为Win10操作系统的原因,系统不会添加一个默认的英文输入法。 所以这时候所有程序进入后,输入法全是搜狗。 解决方法: 在搜狗输入法的状态栏中,鼠标右键,打开"输入法管理", 点击"添加输入法",添加一个输入语言为"英语(美国)",输入法为"US"的输入法(不要添加"中文(简体,中国)","US"输入法,这个输入法会出现上面Gif中的问题)。 添加成功后,将其"设为默认"(切记设置,因为垃圾搜狗将**搜狗输入法**设置为默认输入法)。
Author
Owner

@DHowett commented on GitHub (Oct 9, 2020):

@skyline75489 may I request some assistance in understanding/communicating about this bug report? 😄

@DHowett commented on GitHub (Oct 9, 2020): @skyline75489 may I request some assistance in understanding/communicating about this bug report? :smile:
Author
Owner

@skyline75489 commented on GitHub (Oct 9, 2020):

@DHowett The screen capture you see in @eromoe 's comment is people using Sogou IME which is a very popular Chinese IME in China.

The comments from @Refactoring explains the usage of Sogou is the root cause of the problem. He said that most people would install Sogou and uninstall the stock Microsoft Pinyin IME, resulting in only one Chinese IME in the OS. By doing this Sogou will launch together with every program, including WT.

He proposed a solution, that is adding an en-US IME and set it to default (Sogou will make itself the default IME after installing).

Personally I don't use Sogou so I'm not experiencing the issue. But I believe what @Refactoring said makes sense. I don't honestly know the "broken" Sogou part since I don't use it.

@skyline75489 commented on GitHub (Oct 9, 2020): @DHowett The screen capture you see in @eromoe 's comment is people using [Sogou IME](https://pinyin.sogou.com/) which is a very popular Chinese IME in China. The comments from @Refactoring explains the usage of Sogou is the root cause of the problem. He said that most people would install Sogou and uninstall the stock Microsoft Pinyin IME, resulting in only one Chinese IME in the OS. By doing this Sogou will launch together with every program, including WT. He proposed a solution, that is adding an en-US IME and set it to default (Sogou will make itself the default IME after installing). Personally I don't use Sogou so I'm not experiencing the issue. But I believe what @Refactoring said makes sense. I don't honestly know the "broken" Sogou part since I don't use it.
Author
Owner

@eromoe commented on GitHub (Oct 9, 2020):

It not limit to particular IME . The key problem is :

  • windows 10 would not create a default English IME as XP / win7 did .

This make other IME shows on input area at default . Usually I don't expect that , I manully add an English IME to overcome currently .

This happened on terminal is very annoy .

@eromoe commented on GitHub (Oct 9, 2020): It not limit to particular IME . The key problem is : - windows 10 would not create a default English IME as XP / win7 did . This make other IME shows on input area at default . Usually I don't expect that , I manully add an English IME to overcome currently . This happened on terminal is very annoy .
Author
Owner

@skyline75489 commented on GitHub (Oct 9, 2020):

@eromoe By saying "creating a default English IME" do you mean creating one after deleting the default Microsoft Pinyin? I think that people inside the Windows OS team may have more knowledge about this.

Personally I'm happy with the performance and reliability of the stock Microsoft Pinyin, especially after 2004 release. Overall the IME experience does not cause me serious problems.

@skyline75489 commented on GitHub (Oct 9, 2020): @eromoe By saying "creating a default English IME" do you mean creating one after deleting the default Microsoft Pinyin? I think that people inside the Windows OS team may have more knowledge about this. Personally I'm happy with the performance and reliability of the stock Microsoft Pinyin, especially after 2004 release. Overall the IME experience does not cause me serious problems.
Author
Owner

@eromoe commented on GitHub (Oct 9, 2020):

@skyline75489
Yes , Microsoft Pinyin is at same position as sougou Pinyin . We only need plain English input(in English Language) as default without selection box : image

Below setting doesn't work with English input(in Chinese Language) :
image

I use ctrl+shift to switch when I need to type native word , this is a habit since XP . I feel very bad when everytime focused on a input box along with native IME word selection box show up , because we usually need type alphabet and number .

@eromoe commented on GitHub (Oct 9, 2020): @skyline75489 Yes , Microsoft Pinyin is at same position as sougou Pinyin . We only need **plain** English input(in English Language) as default without selection box : ![image](https://user-images.githubusercontent.com/3938751/95535279-a181d500-0a1a-11eb-8e9e-9f1a00088892.png) Below setting doesn't work with English input(in Chinese Language) : ![image](https://user-images.githubusercontent.com/3938751/95536222-0f2f0080-0a1d-11eb-8659-5b95d45d37c7.png) I use `ctrl+shift` to switch when I need to type native word , this is a habit since XP . I feel very bad when everytime focused on a input box along with native IME word selection box show up , because we usually need type alphabet and number .
Author
Owner

@skyline75489 commented on GitHub (Oct 9, 2020):

Ah. I see. So the issue for Sogou can be separated into two parts:

  1. When users uninstall the stock Microsoft Pinyin (which is the default IME in a zh-CN version of Win10) and install third party IME like sogou, which make itself the default IME, there will only be one IME in the OS and will be activated when every program launches. This is fine for most programs but not for WT, which usually expects ASCII things.
  2. For some reason, Sogou is not behaving correctly in WT as in other programs, making it even more painful for people to use. In my experience, this actually happens a lot with third party IMEs. Those IMEs like Sogou was born since the age of Win98/XP and keeps evolving since then. Microsoft Pinyin was terrible in those days so third party IMEs gained a huge amount of market share. But third party IMEs may not work well with applications that does not even expect third party IMEs. I think this should fall into the same category as #7673 which itself is an internal bug report from an IME vendor.

As for the IME configuration, personally I have this:

image

I'm using the en-US version of Windows so naturally I have en-US at first, then I installed the zh-CH language pack and got the Microsoft Pinyin. I guess this is why I'm not experience the IME difficulty.

@skyline75489 commented on GitHub (Oct 9, 2020): Ah. I see. So the issue for Sogou can be separated into two parts: 1. When users uninstall the stock Microsoft Pinyin (which is the default IME in a zh-CN version of Win10) and install third party IME like sogou, which make itself the default IME, there will only be one IME in the OS and will be activated when every program launches. This is fine for most programs but not for WT, which usually expects ASCII things. 2. For some reason, Sogou is not behaving correctly in WT as in other programs, making it even more painful for people to use. In my experience, this actually happens a lot with third party IMEs. Those IMEs like Sogou was born since the age of Win98/XP and keeps evolving since then. Microsoft Pinyin was terrible in those days so third party IMEs gained a huge amount of market share. But third party IMEs may not work well with applications that does not even expect third party IMEs. I think this should fall into the same category as #7673 which itself is an internal bug report from an IME vendor. As for the IME configuration, personally I have this: ![image](https://user-images.githubusercontent.com/4710575/95536338-67fe9900-0a1d-11eb-82e1-b6829c8ee793.png) I'm using the en-US version of Windows so naturally I have en-US at first, then I installed the zh-CH language pack and got the Microsoft Pinyin. I guess this is why I'm not experience the IME difficulty.
Author
Owner

@eromoe commented on GitHub (Oct 9, 2020):

Above is a little diverge , previous Key Problem I said is mainly point to that comment in Chinese. It is not limit to Sougou .

The key points of this issue I had expressed by the gif, these are definitely bugs :

  1. Terminal automatically enable input method(not prime, it is second one) at startup , no other softwares do this .

    It doesn't recognize English input(in Chinese Language) at top(prime/default position) , but would use English input(in English Language) when it is on top

  2. Terminal automatically enable a broken input method , which behaviour is different from the original input metod, mainly lost words select box. Need quit input method , enter again to gain words select box , see below gif :

    even the Chinese IME is broken , not limit to Sougou/Microsoft IME as I remenber .

tm

@eromoe commented on GitHub (Oct 9, 2020): Above is a little diverge , previous `Key Problem` I said is mainly point to that comment in Chinese. It is not limit to Sougou . The key points of this issue I had expressed by the gif, these are definitely bugs : 2. Terminal automatically enable `input method`(not prime, it is second one) at startup , no other softwares do this . > It doesn't recognize English input(in Chinese Language) at top(prime/default position) , but would use English input(in English Language) when it is on top 3. Terminal automatically enable a broken `input method` , which behaviour is different from the original input metod, mainly lost words select box. Need quit input method , enter again to gain words select box , see below gif : > even the Chinese IME is broken , not limit to Sougou/Microsoft IME as I remenber . ![tm](https://user-images.githubusercontent.com/3938751/80167952-4ac34300-8614-11ea-84e8-5bb9cd3e893b.gif)
Author
Owner

@Refactoring commented on GitHub (Oct 12, 2020):

As 'skyline75489' and 'eromoe' say, windows 10 would not create a default English IME as XP / win7 did。But, Sogou Pinyin set the wrong English input , which led to the problem in Gif. The correct way to add gif below me is explained.

ReproduceAndResolves_Small

@Refactoring commented on GitHub (Oct 12, 2020): As 'skyline75489' and 'eromoe' say, windows 10 would not create a default English IME as XP / win7 did。But, Sogou Pinyin set the wrong English input , which led to the problem in Gif. The correct way to add gif below me is explained. ![ReproduceAndResolves_Small](https://user-images.githubusercontent.com/451129/95692759-bb115f80-0c5a-11eb-81e9-867969208867.gif)
Author
Owner

@YanceyChiew commented on GitHub (Apr 24, 2022):

I believe that changing this line (/src/cascadia/TerminalControl/TSFInputControl.cpp#L41)

        _editContext.InputScope(CoreTextInputScope::Text);

to

        _editContext.InputScope(CoreTextInputScope::AlphanumericHalfWidth);

should make CJK IME open in English input mode by default.

But the problem is that after switching to composition mode(eg, Chinese Pinyin), it will be difficult to switch back dynamically through code. In fact I found a workaround but it raises other problems:

                // c# sample code    
                case VirtualKey.Enter:
                    _editContext.InputScope = CoreTextInputScope.Password;
                    _editContext.NotifyFocusLeave();
                    _editContext.NotifyFocusEnter();
                    _editContext.InputScope = CoreTextInputScope.AlphanumericHalfWidth;
                    break;

When inputting through the physical keyboard, the next time you switch to composition mode you will need to press shift twice (normally only once).

A more serious problem occurs when using the soft keyboard for input. If speculate from the code it may cause the soft keyboard to flash once or twice, which already affects the user experience, but the reality is worse, soft keyboard will be fixed to the password mode and cannot be switched.

The soft keyboard behaves very strangely, If you adjust where _editContext.NotifyFocusLeave() and _editContext.NotifyFocusEnter() appear in the code, the input mode of the soft keyboard can also be switched to English, but another same(Space, Enter or Escape, other key bindings seem do not work) keystroke will make it switch back. Physical keyboard keystrokes are invalid at this time, although the input method indicator in the status bar shows its desired state.

                // c# sample code
                case VirtualKey.Space:


                    _editContext.NotifyFocusLeave();
                    _editContext.InputScope = CoreTextInputScope.Password;  
                    _editContext.NotifyFocusEnter();

                    _editContext.NotifyFocusLeave();
                    _editContext.InputScope = CoreTextInputScope.AlphanumericHalfWidth;
                    _editContext.NotifyFocusEnter();



                    break;

I didn't find an API that really fits, maybe it just doesn't exist. For me it was enough to have windows terminal support English input by default when it was opened

@YanceyChiew commented on GitHub (Apr 24, 2022): I believe that changing this line [(/src/cascadia/TerminalControl/TSFInputControl.cpp#L41)](https://github.com/microsoft/terminal/blob/87f5034db1eb0102358d05eeff82ebcc8032c9be/src/cascadia/TerminalControl/TSFInputControl.cpp#L41) ```cpp _editContext.InputScope(CoreTextInputScope::Text); ``` to ``` cpp _editContext.InputScope(CoreTextInputScope::AlphanumericHalfWidth); ``` should make CJK IME open in English input mode by default. But the problem is that after switching to composition mode(eg, Chinese Pinyin), it will be difficult to switch back dynamically through code. In fact I found a workaround but it raises other problems: ```cs // c# sample code case VirtualKey.Enter: _editContext.InputScope = CoreTextInputScope.Password; _editContext.NotifyFocusLeave(); _editContext.NotifyFocusEnter(); _editContext.InputScope = CoreTextInputScope.AlphanumericHalfWidth; break; ``` When inputting through the physical keyboard, the next time you switch to composition mode you will need to press shift twice (normally only once). A more serious problem occurs when using the soft keyboard for input. If speculate from the code it may cause the soft keyboard to flash once or twice, which already affects the user experience, but the reality is worse, soft keyboard will be fixed to the password mode and cannot be switched. The soft keyboard behaves very strangely, If you adjust where `_editContext.NotifyFocusLeave()` and `_editContext.NotifyFocusEnter()` appear in the code, the input mode of the soft keyboard can also be switched to English, but another same(Space, Enter or Escape, other key bindings seem do not work) keystroke will make it switch back. Physical keyboard keystrokes are invalid at this time, although the input method indicator in the status bar shows its desired state. ```cs // c# sample code case VirtualKey.Space: _editContext.NotifyFocusLeave(); _editContext.InputScope = CoreTextInputScope.Password; _editContext.NotifyFocusEnter(); _editContext.NotifyFocusLeave(); _editContext.InputScope = CoreTextInputScope.AlphanumericHalfWidth; _editContext.NotifyFocusEnter(); break; ``` --- I didn't find an API that really fits, maybe it just doesn't exist. For me it was enough to have windows terminal support English input by default when it was opened
Author
Owner

@qqkookie commented on GitHub (Jun 18, 2023):

Problem of CJK IME on terminal start up is related but different matter, I guess.
Most CJK IME is in alpha mode on first activation. Most CJK IME's are capable of typing English alphabet or US-ASCII input without switching to US-ASCII IME. We just have to tell CJK IME to change mode from CJK composition mode to ALPHA mode, not switching from CJK IME to US ASCII IME. Currently this mode change is done manually by pressing <Right-Alt> key on standard US IBM 101 type keyboard or dedicated Alpha/CJK conversion key on CJK-localized IBM 103 type keyboard.

So we should call ImmSetConversionStatus(hImc, IME_CMODE_ALPHANUMERIC, IME_SMODE_NONE); on <Escape or <Return> key input.

I tried to insert such code into src/host/input.cpp, HandleGenericKeyEvent(), but failed.
The host/input.c is not right place to call IME call.

I also tried src/interactivity/win32/Windowio.cpp, HandleKeyEvent(), and
src/terminal/input/terminalinput.cpp TerminalInput::HandleKey(), but both failed, too.

src/terminal/input/terminalinput.cpp TerminalInput::HandleKey() seems to be very promising.
But I can't get console window handle & IME context with GetConsoleWindow() & ImmGetContext()

Any help or idea?

@qqkookie commented on GitHub (Jun 18, 2023): Problem of CJK IME on terminal start up is related but different matter, I guess. Most CJK IME is in alpha mode on first activation. Most CJK IME's are capable of typing English alphabet or US-ASCII input without switching to US-ASCII IME. We just have to tell CJK IME to change mode from CJK composition mode to ALPHA mode, not switching from CJK IME to US ASCII IME. Currently this mode change is done manually by pressing \<Right-Alt> key on standard US IBM 101 type keyboard or dedicated Alpha/CJK conversion key on CJK-localized IBM 103 type keyboard. So we should call `ImmSetConversionStatus(hImc, IME_CMODE_ALPHANUMERIC, IME_SMODE_NONE);` on \<Escape or \<Return> key input. I tried to insert such code into `src/host/input.cpp, HandleGenericKeyEvent()`, but failed. The host/input.c is not right place to call IME call. I also tried `src/interactivity/win32/Windowio.cpp, HandleKeyEvent()`, and `src/terminal/input/terminalinput.cpp TerminalInput::HandleKey()`, but both failed, too. `src/terminal/input/terminalinput.cpp TerminalInput::HandleKey()` seems to be very promising. But I can't get console window handle & IME context with GetConsoleWindow() & ImmGetContext() Any help or idea?
Author
Owner

@qqkookie commented on GitHub (Jun 20, 2023):

I made good progress. Now it works on my PC, at least. I need more testing, I guess.
Place to add the IMM calls above is "src/terminal/input/terminalInput.cpp" : TerminalInput::HandleKey()
Now I need to add configuration option to turn this behavior on/off.
Any idead or help?

@qqkookie commented on GitHub (Jun 20, 2023): I made good progress. Now it works on my PC, at least. I need more testing, I guess. Place to add the IMM calls above is "src/terminal/input/terminalInput.cpp" : TerminalInput::HandleKey() Now I need to add configuration option to turn this behavior on/off. Any idead or help?
Author
Owner

@qqkookie commented on GitHub (Jun 22, 2023):

Hmm.. I added terminal Setting/Interaction UI and it works.
But I cannot apply the global terminal setting to TerminalInput::HandleKey(). The global boolean variable which controls this feature on/off is _setting.KeyAlphaMode or ServiceLocator::LocateGlobals().KeyAlphaMode(). But both are inaccessible or unusable in the TerminalInput class. I am not familiar with overall structure of this project. I guess that the global _settings are defined and used in few places: IControlSettings, InteractionViewModel, TerminalSettings.h, GlobalAppSettings and others. But none of them is usable in src/terminal/input/terminalInput.cpp.
How to add new feature control setting/option to shared library function? Anyone of such experience or knowledge?
Here is my work in progress: @qqkookie/terminal/tree/Kookie

@qqkookie commented on GitHub (Jun 22, 2023): Hmm.. I added terminal Setting/Interaction UI and it works. But I cannot apply the global terminal setting to `TerminalInput::HandleKey()`. The global boolean variable which controls this feature on/off is `_setting.KeyAlphaMode` or `ServiceLocator::LocateGlobals().KeyAlphaMode()`. But both are inaccessible or unusable in the `TerminalInput` class. I am not familiar with overall structure of this project. I guess that the global _settings are defined and used in few places: IControlSettings, InteractionViewModel, TerminalSettings.h, GlobalAppSettings and others. But none of them is usable in `src/terminal/input/terminalInput.cpp`. How to add new feature control setting/option to shared library function? Anyone of such experience or knowledge? Here is my work in progress: [`@qqkookie/terminal/tree/Kookie`](https://github.com/qqkookie/terminal/tree/Kookie)
Author
Owner

@lhecker commented on GitHub (Apr 18, 2024):

We just published a major update to our IME implementation in the nightly Canary branch. It was rewritten from the ground up and has tons of improvements! If you're interested in trying it out, you can get it here: https://aka.ms/terminal-canary-installer
If you already have the Canary build installed, you can use this link to force an update.

If you encounter any issues or have any suggestions, or if you simply like/dislike the changes, please let us know! Thank you for bearing with us. 😊

@lhecker commented on GitHub (Apr 18, 2024): We just published a major update to our IME implementation in the nightly Canary branch. It was rewritten from the ground up and has tons of improvements! If you're interested in trying it out, you can get it here: https://aka.ms/terminal-canary-installer If you already have the Canary build installed, you can use this link to force an update. If you encounter any issues or have any suggestions, or if you simply like/dislike the changes, please let us know! Thank you for bearing with us. 😊
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1729