Page 1 of 1

[wheybags] [0.17.9] Rich text tags can't be deleted

Posted: Mon Mar 11, 2019 12:24 am
by SupplyDepoo
If I enter rich text tags like

Code: Select all

[img=item/assembling-machine-2] AP [font=default-small]1.5/s
for my blueprint name and later edit it and delete some tags, the tags don't go completely away. They're appended to whatever I change the name to.

You can see this by selecting all, copying and pasting in a text editor.

For example, my blueprint name is now:

Code: Select all

[img=item/assembling-machine-2] AP [font=default-small]1.5/s[font=default-small][font=default-large-bold][color=white][color=white][font=default][font=debug-mono][font=debug][color=0.5,0,][color=red]
I cannot remove the tags at the end and when I try to edit the title of the blueprint I get a "label is too large" error!

Even if I select all and delete, the formatting tags remain.
2019-03-11 01_58_06.gif
2019-03-11 01_58_06.gif (2.85 MiB) Viewed 4089 times

Re: [0.17.9] Rich text tags can't be deleted

Posted: Mon Mar 11, 2019 12:10 pm
by billbo99
Will the 200 character limit be increase on train stations? Its going to get used up fast with all the Rich Text people are starting to use.

Re: [wheybags] [0.17.9] Rich text tags can't be deleted

Posted: Tue Mar 12, 2019 3:09 pm
by wheybags
Thanks for the report. Fixed for the next release.

Re: [wheybags] [0.17.9] Rich text tags can't be deleted

Posted: Wed Mar 13, 2019 7:20 am
by VuiMuich
billbo99 wrote:
Mon Mar 11, 2019 12:10 pm
Will the 200 character limit be increase on train stations? Its going to get used up fast with all the Rich Text people are starting to use.
Maybe for rich text entity icons a conversion to to Unicode glyphs with use of the UTF+16 PUA could be a solution.
Iirc Unicode is implemented anyway for support of Kanji/Kana, Kyrilic, etc.
Or is it just UTF+8?

Re: [wheybags] [0.17.9] Rich text tags can't be deleted

Posted: Wed Mar 13, 2019 8:12 am
by wheybags
Unfortunately, it is just utf-8 stored in an std::string, and we need to do all unicode manipulation manually :(
Personally, I would switch the whole thing to 32 bit wide chars, and use some special reserved unicode range to store ids which would map to our special text tags under the hood, so we could just cleanly iterate and process text, but to force support for that into our existing gui library, and onto the entire rest of the codebase would be literal hell.
Would have made things much easier to implement though, and saved a load of subtle byte-position-vs-unicode-index bugs.
Also, having in-line image tags count as 1 char for editing purposes would have been amazing (currently, we go to great lengths to fake that effect, by calculating where the cursor should actually move to when you hit right arrow with your cursor just before an img tag, and many many other edge cases).

Re: [wheybags] [0.17.9] Rich text tags can't be deleted

Posted: Wed Mar 13, 2019 11:00 am
by VuiMuich
Oh, then you probably need a capable intern to go through this hell :twisted:
It will be a good lesson for any upcoming developer.

If the urge for Mac developers wouldn’t be so big it also would be a good job application test ;)

And ofc it was actually to obvious that you implemented it the way it is after well consideration.

Re: [wheybags] [0.17.9] Rich text tags can't be deleted

Posted: Mon Apr 22, 2019 12:33 pm
by ownlyme
you should be able to mark the transition between the fonts and delete it, after your text there will appear the closing tags then