UFO: Alien Invasion Issue Tracker
star_faded.png
Please log in to bookmark issues
bug_report_small.png
OPEN  Bug report #5106  -  Textboxes are still too smart...
Posted Sep 01, 2013 - updated Aug 19, 2015
Issue details
  • Type of issue
    Bug report
  • Status
     
    Open
  • Assigned to
    Not assigned to anyone
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
     drane
  • Owned by
    Not owned by anyone
  • Estimated time
    Not estimated
  • Category
    User interface
  • Resolution
    Not determined
  • Priority
    Not determined
  • Reproducability
    Not determined
  • Severity
    Not determined
  • Targetted for
    icon_milestones.png Not determined
  • Complexity
    icon_customdatatype.png Not determined
  • Platform
    icon_customdatatype.png Not determined
  • Architecture
    icon_customdatatype.png Not determined
Issue description
Ten months ago, UFO:AI would crash when an underscore was the first character typed into any textbox. It was because text typed into a textbox was being passed to function CL_Translate on every keystroke, in combination with some buffer overflows and/or off-by-one errors. CL_Translate performs text translation and conversion of message ids to plain text.

Most of the issues were worked around in these patches and a few others: https://github.com/ufoai/ufoai/compare/4c582613df5a...061523ffefb6

However, there remain some more issues, although the game probably won't crash because of them. Attached are some screenshots of the Employees screen.

Screenshot 1: Leading underscores seem to get truncated, but it's really because of gettext lookup.

Screenshot 2: Text with leading underscores CAN still get translated. This should only occur if a particularly short string is being translated by the game, or a user has a peculiar taste in names. In this screenshot, the text has been translated into French.

Screenshot 3: Message IDs can get converted to text. Note how the multi-line text spills over into the area below the textbox. Admittedly, this can't be anything but deliberate, and anybody who does this deserves what they get.

(At one point, I thought that names that converted to text that was too long couldn't be changed, but they can. The cursor just isn't visible at first. Hit the backspace key to make the key invalid, and the cursor will reappear.)

I would suggest that editable textboxes not perform translation / conversion on their contents. The only time it should occur is when the textboxes are initialized with canned text. For example, the initial suggestion for the starting base's name is "Home" in English and "Base Principale" in French. If this were done, a lone underscore could be considered a proper name again by the function Com_IsValidName, if desired.

Steps to reproduce this issue
Start a game. Go to any editable textbox -- first base name, employee name, already-created base name.

a) Type "_asdf" (without quotes). Hit enter. Note how the underscore disappears as more text is typed. If the entered text is displayed anywhere that's not a textbox (e.g. geoscape, soldier chooser), it will show the underscore.

Delete the text. Note that once the "asdf" is deleted, the underscore reappears. But hitting enter with just the underscore reverts the name, as it is not considered a proper name by the game (function Com_IsValidName).

c) Change the language to something other than English. Delete the text and type "_No pre research info available" (without quotes). Notice how the text displayed changes as the last character is typed. But deleting a character or typing another one undoes the change.

d) Delete the text and type "*msgid:medikit_txt" without quotes. Notice how the text displayed changes as the last character is typed. But deleting a character or typing another one undoes the change.