Fix popup for modifying string options #61284
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
None
Purpose of change
#61166 added a check and debugmsg to warn if a string was being trimmed to a length <= 0, because that suggests something strange is going on in the UI layout. This debugmsg pops up when setting string options. It can be ignored without a crash, but still suggests something odd is going on.
Before.mp4
Fixes #61266
Describe the solution
The root cause appears to be:
This PR:
The second change is because I felt the formatting of string options should match the formatting of int/double options.
Describe alternatives you've considered
There's probably a valid reason somewhere to have a blank title in the popup, and setting a default title would not prevent someone from calling .title("") and potentially ending up in the same spot.
Testing
I believe the report of the same debugmsg popup when modifying default gameplay shortcuts on Android should be fixed as well, but I am unable to test it.
I opened a variety of string_input_popups, including modifying string options:
At several window sizes, and in several non-English languages:
A search of the code found two other locations where .title() is not called on a string_input_popup. Editing an item in the map editor:
And looking at a different faction's zones in debug mode
Both locations would hit a debugmsg prior to this PR, both work correctly afterwards. I chose not to make any changes to their formatting.
Additional context