question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unsupported characters (specifically emojis) break the textbox

See original GitHub issue

I 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

  1. Use Win+. to insert some emoji or copy paste these ones into the example text box: 😂😂😂
  2. Try clicking in the middle of the ��� rendered as a placeholder for the emoji
  3. Try pressing backspace a few times to delete the emoji
  4. Try pressing delete a few times to forward-delete the emoji
  5. Press home
  6. Type aaa
  7. Press end
  8. Type aaa again
  9. Press Ctrl+A and then backspace
  10. Paste the emoji again
  11. Press home
  12. Press right arrow once
  13. Type aaa

Expected behavior

Sanity

Actual behavior

Insanity

  1. 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.
  2. You can’t set the cursor into the middle of the emoji (it always renders as if it’s at the start
  3. You can’t remove the emoji (maybe makes sense since the text cursor is at the start.)
  4. You can’t remove the emoji (doesn’t make sense.)
  5. Text cursor appears between aaa and ��� instead of at the end
  6. The aaa appears at the end as expected, but the text cursor position is totally wrong.

image

  1. ✅ The textbox is cleared even though deleting the emojis failed earlier
  2. Same as 1
  3. The text cursor doesn’t advance (not a surprise at this point)
  4. The text stops rendering entirely and the text cursor is floating in the textbox:

image


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:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

5reactions
Gillibaldcommented, Sep 28, 2020

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.

2reactions
PathogenDavidcommented, Sep 28, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found