Rich Text control truncating width based on unformatted string

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

klugemonkey
Inserter
Inserter
Posts: 24
Joined: Tue Jun 12, 2018 5:07 am
Contact:

Rich Text control truncating width based on unformatted string

Post by klugemonkey »

This is not a new issue by any means, but has been annoying for quite some time...

The Browse games window shows a table that has a 'Name' column whose entries are determined by the rich text string value of the "name" key in the server-settings.json file.

The string in the server-settings.json is not limited in length since it is entered by a server admin and there is no way to limit in a text file, other than when the json file is parsed. It is not known if the data is actually parsed in its entirety.

Upon display of the rich text string in the table in the Browse games dialog accessible from the Browse public games menu option under the Multiplayer option from the Main menu, text appears to be truncated for long strings to a limit of 50 characters.

It is entirely possible that this truncation occurs on the data by the control itself having a limit on the number of characters that it determines it can display as a result of the set width of the column.

However, it appears as if the coding of the control does not take into account the actual rendered width of the rich text and merely characters widths or worse, counts of characters in the string provided.

Furthermore there is no error checking on the string to account for the rich text formatting, resulting in truncated strings that are malformed.

This functionality in the GUI on how rich text is rendered in an actual table cell or other width limited control, should be reworked to provide the best possible user experience.

Currently, if one were to create a server name using rich text tags such as "[entity=behemoth-biter]This is a really long server name", the entry would truncated as "[entity=behemoth-biter]This is a really lon", properly displaying the entity icon, but not handling the color nor displaying the full text. This even though the display width of the icon and the text would actually fit in the cell when formatted properly.

Is is suggested that icon and string widths be calculated based on rendered output, not on the formatted input string for purposes of rich text based controls.

Implementing this functionality would allow for a better user experience with fully length strings in a variety of rich text colors and the ability to use icons with longer names (i.e. personal-laser-defense-equipment) without the formatting text counting towards the cell width limit.

Thank you for your consideration of this functionality for the future gui.
User avatar
PennyJim
Long Handed Inserter
Long Handed Inserter
Posts: 83
Joined: Wed Jan 18, 2023 3:49 am
Contact:

Re: Rich Text control truncating width based on unformatted string

Post by PennyJim »

Just a note, the color tags in your example rich text got consumed by the forums rich text :P

Breaking the formatting by inserting a character into your [color>=orange] tag will not let the forum see it as a proper tag. You could also do it with a tag that'll itself disappear: [color=orange]

And `acid` is not a named color in the world of web, so you'll either have to use a hex code or one of the generally supported named colors if you want to show the closed one actually working.
Post Reply

Return to “Ideas and Suggestions”