Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5125 in orxonox.OLD for trunk/src/util/shell.cc


Ignore:
Timestamp:
Aug 25, 2005, 3:04:49 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: a first command can be executed 'clear'
also improved the seg-fault-protection of the TextEngine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/shell.cc

    r5124 r5125  
    203203  // remove all chars from the BufferTexts.
    204204  if (this->bufferText)
    205     for (int i; i < this->bufferDisplaySize; i++)
    206     {
    207       this->bufferText[i]->setText(NULL);
    208     }
    209 
     205    for (int i = 0; i < this->bufferDisplaySize; i++)
     206    {
     207      this->bufferText[i]->setText(NULL, true);
     208    }
    210209
    211210  // delete all the Chars in the Buffers
    212211  tIterator<char>* charIterator = this->buffer->getIterator();
    213212  char* charElem = charIterator->firstElement();
    214 
    215213  while (charElem != NULL)
    216214  {
     
    220218  }
    221219  delete charIterator;
     220  delete this->buffer;
     221  this->buffer = new tList<char>;
    222222}
    223223
     
    343343  if (likely(this->inputLine != NULL))
    344344  {
    345     delete [] this->inputLine;
     345    delete[] this->inputLine;
    346346  }
    347347  this->inputLine = new char[1];
    348348  *this->inputLine = '\0';
     349  this->inputLineText->setText(this->inputLine, true);
    349350}
    350351
     
    405406{
    406407  this->addBufferLineStatic("Execute Command: %s\n", this->inputLine);
    407   delete this->inputLine;
    408   this->inputLine = new char[1];
    409   this->inputLine[0]='\0';
    410   this->inputLineText->setText(this->inputLine);
     408
     409  if (!strcmp(this->inputLine, "clear"))
     410  {
     411    this->flushBuffers();
     412  }
     413
     414  this->flushInputLine();
     415
    411416  return false;
    412417}
Note: See TracChangeset for help on using the changeset viewer.