-
Notifications
You must be signed in to change notification settings - Fork 543
8301900: TextArea: Committing text with ENTER in an IME window inserts newline #1351
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
Conversation
|
👋 Welcome back mfox! A progress list of the required criteria for merging this PR into |
|
/issue JDK-8088172 |
|
@beldenfox |
|
/issue JDK-8089803 |
|
@beldenfox |
|
Reviewers: @andy-goryachev-oracle @kevinrushforth /reviewers 2 |
|
@kevinrushforth |
kevinrushforth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes look good. All my testing looks good.
|
I need to amend this PR. If the IM is disabled in the middle of composition we don't dismiss the IM window. In the past that was sort of OK because we ignored the enabled stated and kept sending events to the NSTextInputContext. With this PR we honor the state and stop talking to the context so the IM window just freezes and never goes away. I'll be adding a line of code to ensure we get rid of the IM window when the enabled state changes (which we should have been doing all along). This condition can arise if the user starts composing and then clicks on a control that doesn't accept IM input (like a button). It can also happen with JDK-8087477 which is a bug I'm still investigating. |
|
@beldenfox I don't know whether it's the side effect of that scenario, or a new issue, but try this:
edit: some of the scenarios are described in https://bugs.openjdk.org/browse/JDK-8320912 |
|
... and scenarios described in JDK-8088172 and JDK-8089803 seem to have been fixed. |
| didCommitText = NO; | ||
| nsAttrBuffer = [nsAttrBuffer initWithString: @""]; | ||
| } | ||
| else if (!inputContextHandledEvent || (nsAttrBuffer.length == 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if { ?
I did that with the most recent commit (Jan 27th).
That indicates that you got my most recent commit, otherwise the IME window would not disappear immediately. I'm really glad you caught this. The old code for disabling the IME just called |
Correcting myself: it does clear the composition buffer. But the zero-length commit doesn't seem to be doing what it needs to. |
|
@andy-goryachev-oracle The behavior you're seeing when clicking on another control is a manifestation of https://bugs.openjdk.org/browse/JDK-8320912. I put together a fix for that bug but decided not to roll it into this PR. If it would help testing I could do that. The current code to disable the IME happens after focus has already moved to the node that doesn't want IME input. So the commit that's fired off by |
Are these two bugs independent? Should JDK-8320912 be resolved first? |
They are independent. This bug has to do with how we divide keystrokes between KeyEvents and InputMethodEvents. JDK-8320912 is about cleaning up during focus changes. The order in which they get resolved doesn't matter. |
would it be possible to get JDK-8320912 integrated first then? It seems the scenario it addresses is narrower, and it will be easier to review this bug. |
|
@andy-goryachev-oracle I submitted PR #1356. |
thank you! |
|
Once #1356 is integrated I'll re-review. |
|
@beldenfox could you sync up with the latest master branch please? |
|
Even though it says "This branch has conflicts that must be resolved" there is a green checkmark next to it in the Pull Requests view: https://github.com/openjdk/jfx/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc+label%3Arfr |
|
I'm surprised Skara hasn't noticed that there is a merge conflict -- when it does, it should add a |
|
Skara has noted the merge conflict. I'll get that patched up. I also need to tweak the implementation of setEnabled, it's trying to handle focus moving from node to node but the logic is wrong. |
|
Skara hasn't labeled it, so I'm restating the requirement of 2 reviewers to see if that wakes up the bot to check for the merge conflict. /reviewers 2 |
|
@kevinrushforth |
|
@beldenfox this pull request can not be integrated into git checkout macimefixes
git fetch https://git.openjdk.org/jfx.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
|
Two additions to the code. I was not handling the case where the keystroke didn't commit text but did clear the marked text (getting us out of composition mode). You can do this by repeatedly pressing ESC. When the enabled state changes we shouldn't have any marked text but if we do it should just be discarded. The old code was trying to deal with focusOwner changes but that cleanup has to happen before the enabled state changes instead of after (which is why finishInputMethodComposition exists). |
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell, the new behavior matches the native app one.
有難う
|
@beldenfox This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 14 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
/integrate |
|
Going to push as commit d9263ab.
Your commit was automatically rebased without conflicts. |
|
@beldenfox Pushed as commit d9263ab. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |

In the Mac glass code the presence of "marked" text (which is tracked in the nsAttrBuffer) signals that an IME is active. In this state the current code assumes that when NSTextInputContext handles a
keyDown:it will either generate a call toinsertText:replacementRange:or one of the routines that manipulates the marked (composed) text. But this bug shows that sometimes the IME acts on the event without generating any calls back into glass at all.In this PR the logic is simplified: if the NSTextInputContext handles the
keyDown:and there's marked (composed) text we don't generate a KeyEvent. Otherwise we do. This PR removes theshouldProcessKeyEventflag since it no longer assumes we can catch callbacks to update it correctly.The existing code also assumes that the composition phase ends when the NSTextInputContext calls
insertText:replacementRangeto commit the text. This is true but if the user tries to use a dead-key sequence to generate a non-existent character (like an accented 'q') the context will callinsertTexttwice while handling one key down event. In that case we can't exit the composition mode upon seeing the firstinsertTextcall since it will cause us to mis-handle the second one. This PR defers exiting composition mode until the end ofkeyDown:.I also updated a few deprecated constants so this file no longer generates compiler warnings.
Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1351/head:pull/1351$ git checkout pull/1351Update a local copy of the PR:
$ git checkout pull/1351$ git pull https://git.openjdk.org/jfx.git pull/1351/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1351View PR using the GUI difftool:
$ git pr show -t 1351Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1351.diff
Webrev
Link to Webrev Comment