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

Display Emojis, Kaomojis, and symbols while in IME mode #4688

Merged
9 commits merged into from
Feb 26, 2020

Conversation

leonMSFT
Copy link
Contributor

@leonMSFT leonMSFT commented Feb 21, 2020

Summary of the Pull Request

Currently, while in IME mode, selections with the Emoji/Kaomoji/Symbol Picker (which is brought up with win+.) are not displayed until the user starts a new composition. This is due to the fact that we hide the TextBlock when we receive a CompositionCompleted event, and we only show the TextBlock when we receive a CompositionStarted event. Input from the picker does not count as a composition, so we were never showing the text box, even if the symbols were thrown into the inputBuffer. In addition, we weren't receiving CompositionStarted events when we expected to.

We should be showing the TextBlock when we receive any text, so we should make the TextBlock visible inside of TextUpdatingHandler. Furthermore, some really helpful discussion in #3745 around wrapping the NotifyTextChanged call with a NotifyFocusLeave and a NotifyFocusEnter allowed the control to much more consistently determine when a CompositionStarted and a CompositionEnded.

I've also went around and replaced casts with saturating casts, and have removed the line that sets the textBlock.Width() so that it would automatically set its width. This resolves the issue where while composing a sentence, the textBlock would be too small to contain all the text, so it would be cut off, but the composition is still valid and still able to continue.

PR Checklist

Validation Steps Performed

Tested picking emojis, kaomojis, and symbols with numerous different languages.

@leonMSFT leonMSFT added Area-Input Related to input processing (key presses, mouse, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal. labels Feb 21, 2020
@leonMSFT leonMSFT added this to the Terminal v1.0 milestone Feb 21, 2020

// width is cursor to end of canvas
_textBlock.Width(200); // TODO GitHub #3640: Determine proper Width
Copy link
Member

Choose a reason for hiding this comment

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

Since this got removed, what happens if your composition text is larger than the width of the buffer? Do we just start writing off the end of the window?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, it'll start writing off the end of the window, which actually is the current behavior. Until text wrap-around is implemented, the composition text will always write off the end of the window. Removing this just allows the user to be able to see as much composition text as the window is wide (or until the user resizes the window to make it wider).

src/cascadia/TerminalControl/TSFInputControl.h Outdated Show resolved Hide resolved
src/cascadia/WinRTUtils/inc/Utils.h Show resolved Hide resolved
void TSFInputControl::_SendAndClearText()
{
// call event handler with data handled by parent
_compositionCompletedHandlers(_inputBuffer);
Copy link
Contributor

Choose a reason for hiding this comment

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

Dumb q: the textblock is relaid-out between these events, right? When composition "completes" without starting, that is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, the textblock actually seems to get relaid-out constantly between just about all events, such as TextUpdate, CompositionStarted, or CompositionCompleted events.

@leonMSFT leonMSFT added the AutoMerge Marked for automatic merge by the bot when requirements are met label Feb 26, 2020
@ghost
Copy link

ghost commented Feb 26, 2020

Hello @leonMSFT!

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 31c9d19 into master Feb 26, 2020
@ghost ghost deleted the dev/lelian/imemadness branch February 26, 2020 18:36
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.) AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tabbed IME fails to insert symbols with a chinese input method
4 participants