Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5783 in orxonox.OLD for trunk/src/lib/shell


Ignore:
Timestamp:
Nov 26, 2005, 8:36:36 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: more stl in Shell

Location:
trunk/src/lib/shell
Files:
3 edited

Legend:

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

    r5781 r5783  
    373373
    374374/**
    375  * moves the Display buffer (up or down)
     375 * moves the Display buffer (up + or down - )
    376376 * @param lineCount the count by which to shift the InputBuffer.
     377 *
     378 * @todo make this work
    377379 */
    378380void Shell::moveDisplayBuffer(int lineCount)
    379381{
    380   /// FIXME
    381 //   if (!this->bufferIterator->compareListPointer(ShellBuffer::getInstance()->getBuffer()))
    382 //   {
    383 //     delete this->bufferIterator;
    384 //     this->bufferIterator = ShellBuffer::getInstance()->getBuffer()->getIterator();
    385 //   }
    386 //
    387 //   if (this->bufferOffset == 0)
    388 //    {
    389 //      this->bufferIterator->lastElement();
    390 // //     for (unsigned int i = 0; i < this->bufferDisplaySize; i++)
    391 // //       this->bufferIterator->prevStep();
    392 //    }
    393 //
    394 //   // boundraries
    395 //   if (this->bufferOffset + lineCount > (int)ShellBuffer::getInstance()->getBuffer()->getSize())
    396 //     lineCount = (int)ShellBuffer::getInstance()->getBuffer()->getSize()- this->bufferOffset;
    397 //   else if (this->bufferOffset + lineCount < 0)
    398 //     lineCount = -bufferOffset;
    399 //   this->bufferOffset += lineCount;
    400 //
    401 //   // moving the iterator to the right position
    402 //   int move = 0;
    403 //   while (move != lineCount)
    404 //   {
    405 //     if (move < lineCount)
    406 //     {
    407 //       ++move;
     382  if (this->bufferOffset == 0)
     383   {
     384     this->bufferIterator = ShellBuffer::getInstance()->getBuffer()->end();
     385//     for (unsigned int i = 0; i < this->bufferDisplaySize; i++)
    408386//       this->bufferIterator->prevStep();
    409 //     }
    410 //     else
    411 //     {
    412 //       --move;
    413 //       this->bufferIterator->nextStep();
    414 //     }
    415 //   }
    416 //   // redisplay the buffers
    417 //   tIterator<char> it = *this->bufferIterator;
    418 //   for (unsigned int i = 0; i < this->bufferDisplaySize; i++)
    419 //   {
    420 //     this->bufferText[i]->setText(it.getCurrent(), false);
    421 //     it.prevStep();
    422 //   }
     387   }
     388
     389  // boundraries
     390  if (this->bufferOffset + lineCount > (int)ShellBuffer::getInstance()->getBuffer()->size())
     391    lineCount = (int)ShellBuffer::getInstance()->getBuffer()->size()- this->bufferOffset;
     392  else if (this->bufferOffset + lineCount < 0)
     393    lineCount = -bufferOffset;
     394  this->bufferOffset += lineCount;
     395
     396  // moving the iterator to the right position
     397  int move = 0;
     398  while (move != lineCount)
     399  {
     400    if (move < lineCount)
     401    {
     402      ++move;
     403      this->bufferIterator--;
     404    }
     405    else
     406    {
     407      --move;
     408      this->bufferIterator++;
     409    }
     410  }
     411  // redisplay the buffers
     412  list<char*>::const_iterator it = this->bufferIterator;
     413  for (unsigned int i = 0; i < this->bufferDisplaySize; i++)
     414  {
     415    this->bufferText[i]->setText((*it), false);
     416    it--;
     417  }
    423418}
    424419
  • trunk/src/lib/shell/shell_buffer.cc

    r5781 r5783  
    9292    delete[] (*bufferLine);
    9393  }
    94   this->buffer.erase(this->buffer.begin(), this->buffer.end());
     94  this->buffer.clear();
    9595}
    9696
  • trunk/src/lib/shell/shell_completion.cc

    r5780 r5783  
    352352void ShellCompletion::emptyCompletionList()
    353353{
    354   this->completionList.erase(this->completionList.begin(),
    355                              this->completionList.end());
     354  this->completionList.clear();
    356355}
    357356
Note: See TracChangeset for help on using the changeset viewer.