Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7894 in orxonox.OLD for branches/gui/src/lib/graphics


Ignore:
Timestamp:
May 27, 2006, 4:30:30 AM (19 years ago)
Author:
bensch
Message:

Safer InputLine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/graphics/text_engine/text.cc

    r7893 r7894  
    149149/**
    150150 * @brief removes char characters from the Text.
     151 *
     152 * @note this function checks, if the count can be removed, and if so does it.
     153 * Otherwise the maximum count of characters will be removed.
    151154 */
    152155void Text::removeCharacters(unsigned int chars)
    153156{
    154   this->text.resize(this->text.size()-chars);
     157  if (text.size() > chars)
     158    this->text.resize(this->text.size()-chars);
     159  else if (!text.empty())
     160    text.clear();
     161  this->setupTextWidth();
    155162}
    156163
Note: See TracChangeset for help on using the changeset viewer.