Skip to content
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

Fix IME/CoreTextEditContext not being reset properly #4140

Merged
1 commit merged into from
Jan 8, 2020
Merged

Fix IME/CoreTextEditContext not being reset properly #4140

1 commit merged into from
Jan 8, 2020

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Jan 7, 2020

The first argument to NotifyTextChanged incorrectly was [0,0]
instead of the length of the text to be removed from the
CoreTextEditContext.

Best source of documentation for NotifyTextChanged:
https://docs.microsoft.com/en-us/windows/uwp/design/input/custom-text-input#overriding-text-updates

FYI @DHowett-MSFT (just in case): C++/WinRT uses winrt::param::hstring
for string parameters which intelligently borrows strings. As such you
can simply pass a std::wstring to most WinRT methods without the need
of having to allocate an intermediate hstring. 🙂

Validation Steps Performed

I followed the reproduction instructions of #3706 and #3745 and ensured
the issue doesn't happen anymore.

Closes #3645
Closes #3706
Closes #3745

@lhecker
Copy link
Member Author

lhecker commented Jan 7, 2020

BTW the IME integration is still not quite perfect yet. It's truly the easiest to reproduce if you install the chinese language and play around with the editor. For instance if you switch to chinese and press Win. you'll notice that it fails to insert most of the symbols on the "Symbols" tab most of the time, unless you also type some regular words without the use of Win..

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 7, 2020
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I certainly believe this is better, but considering I don't use the IME on a daily basis, I'll hold my green check pending Phil's approval. Thanks for debugging this!

@zadjii-msft zadjii-msft added Area-Input Related to input processing (key presses, mouse, etc.) Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Product-Terminal The new Windows Terminal. labels Jan 7, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 7, 2020
@DHowett-MSFT
Copy link
Contributor

The winrt::param::hstring thing actually infuriates me a little bit. You cannot generally write code that accepts anything automatically convertible to an hstring because winrt::param is a private namespace. So, if you add an hstring parameter to a function, you must always pass an hstring to it. 😄

Copy link
Contributor

@DHowett-MSFT DHowett-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this. Thank you!

@DHowett-MSFT DHowett-MSFT added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jan 8, 2020
@ghost
Copy link

ghost commented Jan 8, 2020

Hello @DHowett-MSFT!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 83f8973 into microsoft:master Jan 8, 2020
@lhecker lhecker deleted the fix-ime branch January 9, 2020 09:58
@ghost
Copy link

ghost commented Jan 14, 2020

🎉Windows Terminal Preview v0.8.10091.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) AutoMerge Marked for automatic merge by the bot when requirements are met Product-Terminal The new Windows Terminal.
Projects
None yet
4 participants