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 issues with Japanese & Vietnamese IME #13678

Merged
1 commit merged into from
Aug 11, 2022
Merged

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Aug 4, 2022

This commit builds directly on the changes made in #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 #11479
Closes #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+.)

@ghost ghost added Area-i18n Internationalization issues (e.g.: non-US input handling doesn't work) Area-Input Related to input processing (key presses, mouse, etc.) Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, 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 Aug 4, 2022
@lhecker
Copy link
Member Author

lhecker commented Aug 4, 2022

I wasn't sure whether I should integrate these changes into the changes made in #13677. I guess keeping it seperate has the benefit of being easier to backport if we don't trust the changes in the other PR. 🙂

@lhecker lhecker force-pushed the dev/lhecker/tsf-cleanup branch from e158d89 to 87a660e Compare August 4, 2022 23:05
@lhecker lhecker force-pushed the dev/lhecker/13398-tsf-fixes branch from 09fcd4b to 54fd439 Compare August 4, 2022 23:06
@lhecker lhecker added the Needs-Discussion Something that requires a team discussion before we can proceed label Aug 6, 2022
// completion event and we'll write "xin" to the shell. It now has no input focus and won't know
// about the whitespace. If you then write "chaof", it'll emit another composition completion
// event for "xinchaof" and the resulting output in the shell will finally read "xinxinchaof".
// A composition completion event technically doesn't mean that the completed text is now
Copy link

Choose a reason for hiding this comment

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

Wow, this one is correct. IME can change the text in the edit control as it sees fit, you can think of something like autocorrection.
So with the current implementation (before this PR), IME will see a big lump of text without any word delimitation (spaces, dot, comma ...) as they're not notified back to TSF, limiting the ability to provide more advanced text edit functionality that IME can provide.

I have a question regarding the text edit field, is the current command line where the user can input text is not considered a text edit field? And only the composition is considered as a text edit field and has text editing events notified back to TSF?

Copy link
Member

Choose a reason for hiding this comment

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

I have a question regarding the text edit field, is the current command line where the user can input text is not considered a text edit field?

This part is complicated. Right now, we are using an "overlay" text field because we have not connected the command line buffer to the TSF. This is because of how Terminal sees the screen:

0 1 2 3 4 5 6
C : \ > H i .

All of the input and output goes into the same character grid. Terminal does not know that 3 is part of the prompt, and 4 is part of the user input! If we naively sent all that data to TSF, it would look like the user could edit the C:\> part.

Copy link

Choose a reason for hiding this comment

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

All of the input and output goes into the same character grid. Terminal does not know that 3 is part of the prompt, and 4 is part of the user input! If we naively sent all that data to TSF, it would look like the user could edit the C:\> part.

I see, thank you.
On another hand, I think that we can probably just pass that to the TSF, since the text modification should be depended on the text cursor position as well. And even if the TSF's input processors think it can change the text, if the application doesn't change the text then the input processors should follow.

Base automatically changed from dev/lhecker/tsf-cleanup to main August 8, 2022 18:51
@DHowett
Copy link
Member

DHowett commented Aug 8, 2022

This needs a merge or rebase

@lhecker lhecker force-pushed the dev/lhecker/13398-tsf-fixes branch from 54fd439 to f2534a9 Compare August 8, 2022 19:45
@lhecker lhecker removed the Needs-Discussion Something that requires a team discussion before we can proceed label Aug 10, 2022
@zadjii-msft zadjii-msft added the Needs-Second It's a PR that needs another sign-off label Aug 10, 2022
@ghost ghost requested review from PankajBhojwani, carlos-zamora and DHowett August 10, 2022 20:17
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

To some extent, I have to trust this change -- both that it works right and that it feels right. Thank you @kiennq for testing it and reviewing it as well!

@zadjii-msft
Copy link
Member

(this is a test)

@msftbot merge this after #13707 merges

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 11, 2022
@ghost
Copy link

ghost commented Aug 11, 2022

Hello @zadjii-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 ed800dc into main Aug 11, 2022
@ghost ghost deleted the dev/lhecker/13398-tsf-fixes branch August 11, 2022 21:22
@ghost
Copy link

ghost commented Aug 17, 2022

🎉Windows Terminal Preview v1.15.228 has been released which incorporates this pull request.:tada:

Handy links:

@ghost ghost removed the Needs-Second It's a PR that needs another sign-off label Aug 18, 2022
PKRoma pushed a commit to PKRoma/Terminal that referenced this pull request Oct 15, 2022
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
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-i18n Internationalization issues (e.g.: non-US input handling doesn't work) 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 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
4 participants