Unsupported characters (specifically emojis) break the textbox
See original GitHub issueI realize Emoji aren’t supported yet, but I’d expect the � to act appropriately. I’d also worry that other characters besides emojis could cause this.
Note: This crashes instead after upgrading XamlControlsGallery to the latest CI., so this may have been fixed but I can’t be sure until #4754 is fixed.
Environment
Observed in XamlControlsGallery (which is using 0.10.0-preview5) while trying to reproduce #4754 with other Avalonia apps.
Windows 10 2004
Steps to reproduce
- Use Win+. to insert some emoji or copy paste these ones into the example text box: 😂😂😂
- Try clicking in the middle of the ��� rendered as a placeholder for the emoji
- Try pressing backspace a few times to delete the emoji
- Try pressing delete a few times to forward-delete the emoji
- Press home
- Type
aaa
- Press end
- Type
aaa
again - Press Ctrl+A and then backspace
- Paste the emoji again
- Press home
- Press right arrow once
- Type
aaa
Expected behavior
Sanity
Actual behavior
Insanity
- Works mostly as expected, you see ��� which is what you’d expect until https://github.com/AvaloniaUI/Avalonia/issues/1817 is done. However, the text cursor is at the beginning of the text box rather than the end.
- You can’t set the cursor into the middle of the emoji (it always renders as if it’s at the start
- You can’t remove the emoji (maybe makes sense since the text cursor is at the start.)
- You can’t remove the emoji (doesn’t make sense.)
- ✅
- ✅
- Text cursor appears between
aaa
and���
instead of at the end - The
aaa
appears at the end as expected, but the text cursor position is totally wrong.
- ✅ The textbox is cleared even though deleting the emojis failed earlier
- Same as 1
- ✅
- The text cursor doesn’t advance (not a surprise at this point)
- The text stops rendering entirely and the text cursor is floating in the textbox:
This is possibly a duplicate of https://github.com/AvaloniaUI/Avalonia/issues/4754 since it seems to largely deal with the text measuring going haywire.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Restricting emojis and some of the speacial characters ...
I am trying to restrict some of the special characters and emojis while entering data in the edit text box. I want to...
Read more >What are some Invalid data inputs that will break a text box?
I am testing a text box which accepts alpha-numeric character and maximum 255 chars. Apart from normal boundary values, nulls, negative data inputs...
Read more >Inserting (or copying) special characters into text box
Hello: is it possible to insert or copy special characters (specifically a checkmark and en dash) into a text box? Thank you. Solved!...
Read more >Using Emojis & Special Characters in Subject Line or ...
Want to make your subject line pop with an emoji or special character? Learn how and when emojis and special characters can work...
Read more >Use accents and special characters in Keynote on Mac
Enter special characters and symbols · Click in the text where you want to place the character, then choose Edit > Emoji &...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Y TextBox needs to properly handle surrogate pairs and grapheme clusters. That isn’t currently the case. I will start rewriting the TextBox in October.
That definitely aligns with my experiences today. I think it’s probably a law of the universe that text input controls are either terrible to maintain or shatter in the face of edge cases. There is no in-between.