Index: /trunk/src/lib/shell/shell_buffer.cc
===================================================================
--- /trunk/src/lib/shell/shell_buffer.cc	(revision 7760)
+++ /trunk/src/lib/shell/shell_buffer.cc	(revision 7761)
@@ -35,7 +35,5 @@
 
     this->lineCount = 0;
-    this->keepBufferArray[0] = '\0';
     this->bufferArray[0] = '\0';
-    this->keepBuffer = false;
 
     this->setBufferSize(100);
@@ -123,53 +121,35 @@
   void ShellBuffer::addBufferLine(const char* line, va_list arguments)
   {
-    char* inputEnd;
-    char* newLineBegin;
-    char* newLineEnd;
-
     // copy the output to the bufferArray
     vsprintf(this->bufferArray, line, arguments);
 
-    // check if we have something left in the buffers
-    // if so, append the new String to this one.
-    if (unlikely(this->keepBuffer))
+    std::string inputBuffer = this->keepBuffer + this->bufferArray;
+
+    int lineBegin = 0;
+    int lineEnd = 0;
+    // adding all the new Lines
+    while (lineEnd < inputBuffer.size())
     {
-      strcat(this->keepBufferArray, this->bufferArray);
-      inputEnd = this->keepBufferArray + strlen(this->bufferArray);
-      newLineBegin = this->keepBufferArray;
-      this->keepBuffer = false;
-    }
-    else
-    {
-      inputEnd = this->bufferArray + strlen(this->bufferArray);
-      newLineBegin = this->bufferArray;
-    }
+      lineBegin = lineEnd;
+      lineEnd = inputBuffer.find('\n', (lineBegin == 0) ? 0: ++lineBegin);
+      if (likely(lineEnd != std::string::npos ))
+      {
+        this->lineCount++;
 
-    // adding all the new Lines
-    while (newLineBegin < inputEnd)
-    {
-      newLineEnd = strchr(newLineBegin, '\n');
-      if (likely(newLineEnd != NULL && *newLineEnd == '\n'))
-        *newLineEnd = '\0';
-      else
+        printf("Test:: %s \n", inputBuffer.substr(lineBegin, lineEnd - lineBegin).c_str());
+        this->buffer.push_front(inputBuffer.substr(lineBegin, lineEnd - lineBegin));
+        if (likely (this->shell != NULL) && unlikely (this->shell->isActive()))
+          this->shell->printToDisplayBuffer(this->buffer.front());
+      }
+      else      // No end of Line reached.
       {
-        unsigned int len = strlen(newLineBegin);
-        char* copyBuffer = new char[len+1];
-        strcpy(copyBuffer, newLineBegin);
-        strncpy(this->keepBufferArray, copyBuffer, len);
-        delete[] copyBuffer;
-        this->keepBufferArray[len] = '\0';
-        this->keepBuffer = true;
+        this->keepBuffer = inputBuffer.substr(lineBegin, inputBuffer.size() - lineBegin);
         break;
       }
 
-      this->lineCount++;
-      this->buffer.push_front(newLineBegin);
-      if (likely (this->shell != NULL) && unlikely (this->shell->isActive()))
-        this->shell->printToDisplayBuffer(newLineBegin);
+
 
       if (this->buffer.size() > this->bufferSize)
         this->buffer.pop_back();
-
-      newLineBegin = newLineEnd+1;
     }
   }
Index: /trunk/src/lib/shell/shell_buffer.h
===================================================================
--- /trunk/src/lib/shell/shell_buffer.h	(revision 7760)
+++ /trunk/src/lib/shell/shell_buffer.h	(revision 7761)
@@ -8,4 +8,5 @@
 #define _SHELL_BUFFER_H
 
+#include <string>
 #include <list>
 #include <stdarg.h>
@@ -61,6 +62,5 @@
     Shell*                        shell;                              //!< the Registered Shell.
     char                          bufferArray[SHELL_BUFFER_SIZE];     //!< a BUFFER for fast writing
-    char                          keepBufferArray[SHELL_BUFFER_SIZE]; //!< a BUFFER to have multi-non-newLine commands be copied into the shell.
-    bool                          keepBuffer;                         //!< if the keepbuffer contains unfinished lines.
+    std::string                   keepBuffer;                         //!< a BUFFER to have multi-non-newLine commands be copied into the shell.
 
     unsigned long                 lineCount;                          //!< how many Lines have been written out so far.
