Index: /trunk/src/defs/class_id.h
===================================================================
--- /trunk/src/defs/class_id.h	(revision 5181)
+++ /trunk/src/defs/class_id.h	(revision 5182)
@@ -111,4 +111,5 @@
   CL_NULL_ELEMENT_2D            =    0x00000f22,
   CL_SHELL                      =    0x00000f31,
+  CL_SHELL_BUFFER               =    0x00000f32,
 
 
@@ -194,6 +195,7 @@
   CL_NUMBER                     =    0x00000b0c,
   CL_FAST_FACTORY               =    0x00000c01,
-  CL_SHELL_COMMAND              =    0x00000c02,
-
+  CL_SHELL_COMMAND              =    0x00000c11,
+  CL_SHELL_INPUT                =    0x00000c12,
+  CL_SHELL_COMPLETION           =    0x00000c13,
 
   // Spatial Data Separation
Index: /trunk/src/lib/shell/shell_completion.cc
===================================================================
--- /trunk/src/lib/shell/shell_completion.cc	(revision 5181)
+++ /trunk/src/lib/shell/shell_completion.cc	(revision 5182)
@@ -33,7 +33,8 @@
  * @todo this constructor is not jet implemented - do it
 */
-ShellCompletion::ShellCompletion ()
+ShellCompletion::ShellCompletion(ShellInput* input)
 {
   this->completionList = NULL;
+  this->input = input;
 }
 
@@ -61,8 +62,10 @@
 bool ShellCompletion::autoComplete(ShellInput* input)
 {
+  if (input != NULL)
+    this->input = input;
   //PRINTF(3)("AutoCompletion not implemented yet\n");
 
-  char* completionLine = new char[strlen(input->getText())+1];
-  strcpy(completionLine, input->getText());
+  char* completionLine = new char[strlen(this->input->getText())+1];
+  strcpy(completionLine, this->input->getText());
 
   char* commandBegin = strrchr(completionLine, ' ');
@@ -191,10 +194,13 @@
     adder[addLength] = '\0';
 
-
-/*    this->removeCharacters(inputLenght);
-    this->addCharacters(adder);
-    if (addBack != NULL && stringList->getSize() == 1)
-      this->addCharacters("::");
-    delete[] adder;*/
+    if (this->input)
+    {
+     this->input->removeCharacters(inputLenght);
+     this->input->addCharacters(adder);
+
+      if (addBack != NULL && stringList->getSize() == 1)
+       this->input->addCharacters("::");
+     delete[] adder;
+    }
   }
   return true;
Index: /trunk/src/lib/shell/shell_completion.h
===================================================================
--- /trunk/src/lib/shell/shell_completion.h	(revision 5181)
+++ /trunk/src/lib/shell/shell_completion.h	(revision 5182)
@@ -19,5 +19,5 @@
 
  public:
-  ShellCompletion();
+  ShellCompletion(ShellInput* input = NULL);
   virtual ~ShellCompletion();
 
@@ -36,4 +36,5 @@
  private:
    tList<const char>*       completionList;          //!< A list of completions, that are io.
+   ShellInput*              input;
 };
 
Index: /trunk/src/lib/shell/shell_input.cc
===================================================================
--- /trunk/src/lib/shell/shell_input.cc	(revision 5181)
+++ /trunk/src/lib/shell/shell_input.cc	(revision 5182)
@@ -64,4 +64,14 @@
   delete[] this->inputLine;
   delete this->completion;
+
+  tIterator<char>* itH = this->inputHistory->getIterator();
+  char* histEl = itH->firstElement();
+  while (histEl != NULL)
+  {
+    delete[] histEl;
+    histEl = itH->nextElement();
+  }
+  delete itH;
+  delete this->inputHistory;
 }
 
@@ -75,5 +85,4 @@
   this->repeatDelay = repeatDelay;
   this->repeatRate = repeatRate;
-
 }
 
@@ -98,10 +107,10 @@
 void ShellInput::addCharacter(char character)
 {
-  char* addCharLine = new char[strlen(inputLine)+2];
+  char* addCharLine = new char[strlen(this->inputLine)+2];
 
   sprintf(addCharLine, "%s%c", this->inputLine, character);
-  delete this->inputLine;
+  delete[] this->inputLine;
   this->inputLine = addCharLine;
-  this->setText(inputLine, true);
+  this->setText(this->inputLine, true);
 }
 
@@ -112,10 +121,10 @@
 void ShellInput::addCharacters(const char* characters)
 {
-  char* addCharLine = new char[strlen(inputLine)+strlen(characters)+1];
+  char* addCharLine = new char[strlen(this->inputLine)+strlen(characters)+1];
 
   sprintf(addCharLine, "%s%s", this->inputLine, characters);
-  delete this->inputLine;
+  delete[] this->inputLine;
   this->inputLine = addCharLine;
-  this->setText(inputLine, true);
+  this->setText(this->inputLine, true);
 }
 
@@ -132,11 +141,11 @@
     characterCount = strlen(this->inputLine);
 
-  char* removeCharLine = new char[strlen(inputLine)-characterCount+1];
-
-  strncpy(removeCharLine, this->inputLine, strlen(inputLine)-characterCount);
-  removeCharLine[strlen(inputLine)-characterCount] = '\0';
-  delete this->inputLine;
+  char* removeCharLine = new char[strlen(this->inputLine)-characterCount+1];
+
+  strncpy(removeCharLine, this->inputLine, strlen(this->inputLine)-characterCount);
+  removeCharLine[strlen(this->inputLine)-characterCount] = '\0';
+  delete[] this->inputLine;
   this->inputLine = removeCharLine;
-  this->setText(inputLine, true);
+  this->setText(this->inputLine, true);
 }
 
Index: /trunk/src/lib/shell/shell_input.h
===================================================================
--- /trunk/src/lib/shell/shell_input.h	(revision 5181)
+++ /trunk/src/lib/shell/shell_input.h	(revision 5182)
@@ -31,6 +31,4 @@
   bool executeCommand();
   void help() const;
-  const char* getInputString() const { return this->inputLine; };
-
 
   virtual void tick(float dt);
@@ -48,5 +46,4 @@
 
    tList<char>*             inputHistory;           //!< The history of given commands.
-
 };
 
