-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
TextBox SelectAll Input Chinese crash #7304
Comments
Sorry, my bad. |
You need to select all the text And then you type it in with the Chinese input method and it crashes Your video presentation does not include input in the Select All state |
This is this assert failing (for any IME as long as the selection contains new line): wpf/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextStore.cs Lines 1981 to 1985 in fbe2008
The filter trims the text at first line break if wpf/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextEditor.cs Lines 1242 to 1244 in fbe2008
Because the selection including new lines will become part of the |
The documentation for
This is clearly wrong either way. First, it assumes that ENTER key will result into a new line in the text, which might not be the case for IME. Second, it also causes pasted text to be trimmed after the first new line, which normally has nothing to do with ENTER key. It does not prevent new lines in the Filtering during composition update is problematic. First it is rude to mess with the IME by coercing its output in the middle of the composition. If the filtering is desired, it should happen when the composition is finished. Second, the IME is already done by this point, the framework is only replaying the composition events that had happened in the storage, so the IME cannot deal with the coercions even if it wanted to. And finally, it destabilizes the whole replay stack because the recorded text pointers will no longer be valid (you will run into that if you simply remove the assert) and fixing it up would be a lot of work that only the IME might be qualified to do. I am not a big fan of all this filtering to begin with, but we can't really remove it at this stage. I think the right thing to do here is to only do the filtering at the end of the composition, i.e. replace line 1981 above with (Note also that there is |
I used this method to solve the crash problem as stupid as it was |
@q812143836 - Are we good to close this due to the availability of above workaround? |
YES |
@pchaurasia14 Good for @q812143836 that it works for his scenario, but I don't think it is an acceptable workaround. As a trivial example, selecting all text and pressing keys to copy it into clipboard will delete the text instead. I suggested a way to fix the crash which is indeed a bug, i.e. filter after the composition is done. I can submit PR if there is an agreement. |
@miloush - I agree it is not ideal and we'll be happy to review a PR that fixes the issue. |
Windows10
)Problem description:TextBox SelectAll Input Chinese crash
When there are multiple lines of strings, when using the Chinese input method to input, the selected text will crash directly
I know setting AcceptsReturn="True" UndoLimit!="0" will fix this
But I need to use Enter event, so it doesn't work for me
So how should I solve this problem?
The text was updated successfully, but these errors were encountered: