[BUG] Wrong HTML formatting in TextField

Below information pertains to OpenFL 8.9.6. There seems to be a bug in the HTML parser of the TextField class. If you assign the following string to the htmlText field of a class instance:

'<b><font color="#FF0000">red_string</font></b>regular_string<b><font color="#0000FF">blue_string</font></b>'

the result will be:
textfield_bug1

whereas the correct result must be:
textfield_bug3

In order to fix the problem, the highlighted code should be removed from HTMLParser.hx:

However, I’m not 100% certain what was the purpose of those lines according to the author, therefore it would be great if the author double checked this solution to make sure it does not introduce problems in other scenarios.

Are you able to submit a pull request on GitHub?

Never worked with Git beyond downloading something. How to do that?

Having no local tools, the quickest would be to

  1. Create an account on GitHub.
  2. Then visit the repo at https://github.com/openfl/openfl/blob/develop/src/openfl/_internal/formats/html/HTMLParser.hx
  3. Click the pencil icon to edit. This will create a “fork” in your own account.
  4. Edit it then click Save. After that, submit a pull request.

Git is a great tool to learn; it saves my bacon constantly.

Will try to do it today. Thanks for explaining!

Looks like those lines have already been removed from the file in the repository.

I suppose you win then! :wink: