Index: /branches/new_class_id/src/lib/shell/shell_input.cc
===================================================================
--- /branches/new_class_id/src/lib/shell/shell_input.cc	(revision 9864)
+++ /branches/new_class_id/src/lib/shell/shell_input.cc	(revision 9865)
@@ -45,5 +45,4 @@
     this->pressedKey = SDLK_FIRST;
 
-    this->inputLine = "";
     this->historyIT = ShellInput::history.begin();
     this->setHistoryLength(50);
@@ -56,5 +55,5 @@
     {
       //if (!this->isEventSubscribed(ES_SHELL, i))
-        this->subscribeEvent(ES_SHELL, i);
+      this->subscribeEvent(ES_SHELL, i);
     }
     // unsubscribe unused TODO improve.
@@ -63,5 +62,4 @@
     this->unsubscribeEvent(ES_SHELL, SDLK_PAGEUP);
     this->unsubscribeEvent(ES_SHELL, SDLK_PAGEDOWN);
-
   }
 
@@ -90,6 +88,7 @@
   void ShellInput::flush()
   {
-    this->inputLine.clear();
-    this->setText(this->inputLine);
+    this->inputLineBegin.clear();
+    this->inputLineEnd.clear();
+    this->clear();
   }
 
@@ -100,6 +99,7 @@
   void ShellInput::setInputText(const std::string& text)
   {
-    this->inputLine = text;
-    this->setText(this->inputLine);
+    this->inputLineBegin = text;
+    this->inputLineEnd.clear();
+    this->setText(text);
   }
 
@@ -117,6 +117,6 @@
     }
 
-    this->inputLine += character;
-    this->setText(this->inputLine);
+    this->inputLineBegin += character;
+    this->setText(this->inputLineBegin + this->inputLineEnd);
   }
 
@@ -133,6 +133,6 @@
     }
 
-    this->inputLine += characters;
-    this->setText(this->inputLine);
+    this->inputLineBegin += characters;
+    this->setText(this->inputLineBegin + this->inputLineEnd);
   }
 
@@ -148,9 +148,9 @@
       this->historyScrolling = false;
     }
-    if (this->inputLine.size() < characterCount)
-      characterCount = this->inputLine.size();
-
-    this->inputLine.erase(this->inputLine.size() - characterCount, this->inputLine.size());
-    this->setText(this->inputLine);
+    if (this->inputLineBegin.size() < characterCount)
+      characterCount = this->inputLineBegin.size();
+
+    this->inputLineBegin.erase(this->inputLineBegin.size() - characterCount, this->inputLineBegin.size());
+    this->setText(this->inputLineBegin + this->inputLineEnd);
   }
 
@@ -161,10 +161,9 @@
   bool ShellInput::executeCommand()
   {
-    DebugBuffer::addBufferLineStatic("Execute Command: %s\n", this->inputLine.c_str());
-
-    if (this->inputLine.empty())
+    if (this->getInput().empty())
       return false;
-
-    ShellCommand::execute(this->inputLine);
+    DebugBuffer::addBufferLineStatic("Execute Command: %s\n", this->getInput().c_str());
+
+    ShellCommand::execute(this->getInput());
 
     // removing the eventually added Entry (from scrolling) to the List
@@ -176,6 +175,6 @@
 
     // adding the new Command to the History
-    if (history.empty() || history.back() != this->inputLine)
-      this->history.push_back(this->inputLine);
+    if (history.empty() || history.back() != this->getInput())
+      this->history.push_back(this->getInput());
     if (this->history.size() > this->historyLength)
     {
@@ -196,5 +195,5 @@
     if (!this->historyScrolling)
     {
-      this->history.push_back(this->inputLine);
+      this->history.push_back(this->getInput());
       this->historyScrolling = true;
       this->historyIT = --this->history.end();
@@ -234,4 +233,30 @@
   }
 
+  /**
+   * @brief moves the cursor chars Characters to the right.
+   * @param chars how much to move the cursor.
+   */
+  void ShellInput::moveCursor(int chars)
+  {
+    if (chars > 0)
+    {
+      printf("move cursor %d to the right\n", chars);
+      if (chars >= (int) this->inputLineEnd.size())
+        chars = inputLineEnd.size();
+      this->inputLineBegin += this->inputLineEnd.substr(0, chars);
+      this->inputLineEnd.erase(0, chars);
+    }
+    else if (chars < 0)
+    {
+      chars = -chars;
+      printf("move cursor %d to the left\n", chars);
+
+      if (chars >= (int) this->inputLineBegin.size())
+	chars = inputLineBegin.size();
+      this->inputLineEnd = this->inputLineBegin.substr(this->inputLineBegin.size() - chars) + this->inputLineEnd;
+      this->inputLineBegin.erase(this->inputLineBegin.size() - chars);
+    }
+  }
+
 
   /**
@@ -244,10 +269,10 @@
     if (className.empty())
     {
-      PRINT(0)("Help for the most important Shell-commands\n");
-      PRINT(0)("F1 - HELP; F2 - DEBUG; '`' - open/close shell\n");
-      PRINT(0)("input order:\n");
-      PRINT(0)("ClassName [objectName] function [parameter1, [parameter2 ...]]  or\n");
-      PRINT(0)("Alias [parameter]\n");
-      PRINT(0)("- Also try 'help className'");
+      PRINT(0)("== Help for the most important Shell-commands\n");
+      PRINT(0)("  F1 - HELP; F2 - DEBUG; '`' - open/close shell\n");
+      PRINT(0)("  input order:\n");
+      PRINT(0)("   ClassName [objectName] function [parameter1, [parameter2 ...]]  or\n");
+      PRINT(0)("   Alias [parameter]\n");
+      PRINT(0)("- Also try 'help className' or pushing 'TAB'\n");
     }
     else if (!className.empty() && functionName.empty())
@@ -272,17 +297,17 @@
       {
         case SDLK_BACKSPACE:
-          this->removeCharacters(1);
-          break;
+        this->removeCharacters(1);
+        break;
         case SDLK_UP:
-          this->historyMoveUp();
-          break;
+        this->historyMoveUp();
+        break;
         case SDLK_DOWN:
-          this->historyMoveDown();
-          break;
+        this->historyMoveDown();
+        break;
         default:
-          {
-            if (likely(pressedKey < 127))
-              this->addCharacter(this->pressedKey);
-          }
+        {
+          if (likely(pressedKey < 127))
+            this->addCharacter(this->pressedKey);
+        }
       }
     }
@@ -316,8 +341,20 @@
         this->pressedEvent = event.type;
       }
+      else if (event.type == SDLK_LEFT)
+      {
+        this->moveCursor(-1);
+        this->pressedKey = event.type;
+        this->pressedEvent = event.type;
+      }
+      else if (event.type == SDLK_RIGHT)
+      {
+        this->moveCursor(+1);
+        this->pressedKey = event.type;
+        this->pressedEvent = event.type;
+      }
       else if (event.type == SDLK_TAB)
       {
-        this->completion.autoComplete(this->inputLine);
-        this->setText(this->inputLine);
+        this->completion.autoComplete(this->inputLineBegin);
+        this->setText(this->getInput());
       }
       else if (event.type == SDLK_BACKSPACE)
@@ -328,4 +365,12 @@
         this->removeCharacters(1);
       }
+      else if (event.type == SDLK_DELETE)
+      {
+	if (!this->inputLineEnd.empty())
+	{
+	  this->inputLineEnd.erase(0, 1);
+	  this->setText(this->getInput());
+	}
+      }
       else if (event.type == SDLK_RETURN)
       {
Index: /branches/new_class_id/src/lib/shell/shell_input.h
===================================================================
--- /branches/new_class_id/src/lib/shell/shell_input.h	(revision 9864)
+++ /branches/new_class_id/src/lib/shell/shell_input.h	(revision 9865)
@@ -37,5 +37,5 @@
 
     /** @returns the inputLine */
-    const std::string& getInput() const { return this->inputLine; };
+    std::string getInput() const { return this->inputLineBegin + this->inputLineEnd; };
 
     // InputLine
@@ -55,4 +55,6 @@
     void historyMoveDown();
 
+    void moveCursor(int chars);
+
     void help(const std::string& className = "", const std::string& function = "");
 
@@ -64,5 +66,7 @@
     ShellCompletion                   completion;       //!< The Completion Interface.
 
-    std::string                       inputLine;        //!< the Char-Array of the Buffer
+    std::string                       inputLineBegin;   //!< The Line up to the cursor.
+    std::string                       inputLineEnd;     //!< The Line from the cursor on
+
     float                             repeatRate;       //!< The Repeat-Delay.
     float                             repeatDelay;      //!< The delay of the first Character of a given Character.
