Index: /trunk/src/lib/shell/shell_completion.cc
===================================================================
--- /trunk/src/lib/shell/shell_completion.cc	(revision 5186)
+++ /trunk/src/lib/shell/shell_completion.cc	(revision 5187)
@@ -65,13 +65,15 @@
   const char* completionLine;
 
-  long classID;         //< the classID retrieved from the Class.
-  char* classBegin;     //< the beginn of the slass string
-  char* classEnd;       //< the end of the class string
-  char* objectBegin;    //< the begin of the object string
-  char* objectEnd;      //< the end of the object string
-  char* functionBegin;  //< the begin of the function string
-  char* functionEnd;    //< the end of the function string
+  long classID;                    //< the classID retrieved from the Class.
+  tList<BaseObject>* objectList;   //< the list of Objects stored in classID
+  char* classBegin;                //< the beginn of the slass string
+  char* classEnd;                  //< the end of the class string
+  char* objectBegin;               //< the begin of the object string
+  char* objectEnd;                 //< the end of the object string
+  char* functionBegin;             //< the begin of the function string
+  char* functionEnd;               //< the end of the function string
 
   PRINTF(4)("AutoComplete on input\n");
+  this->emptyCompletionList();
 
   if (input != NULL)
@@ -118,4 +120,5 @@
       this->objectComplete("", classID);
   }
+//  else if (inputSplits.getCount() <= 3 )
 
 /*  completionLine = new char[strlen(this->input->getText())+1];
@@ -160,5 +163,5 @@
   if (clList != NULL)
   {
-    const tList<const char>* classList = this->createCompleteList(clList, classBegin);
+    const tList<ShellC_Element>* classList = this->addToCompleteList(clList, classBegin);
     if (classList != NULL)
       this->generalComplete(classList, classBegin, "CL: %s ");
@@ -187,5 +190,5 @@
   {
     printf("\n", boList->firstElement()->getName());
-    const tList<const char>* objectList = this->createCompleteList(boList, objectBegin);
+    const tList<ShellC_Element>* objectList = this->addToCompleteList(boList, objectBegin);
     if (objectList != NULL)
       this->generalComplete(objectList, objectBegin, "%s ");
@@ -215,5 +218,5 @@
  * @return true if ok, false otherwise
  */
-bool ShellCompletion::generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs, const char* addBack, const char* addFront)
+bool ShellCompletion::generalComplete(const tList<ShellC_Element>* stringList, const char* begin, const char* displayAs, const char* addBack, const char* addFront)
 {
   if (stringList == NULL || this->input == NULL )
@@ -222,17 +225,19 @@
     return false;
 
-  const char* addString = stringList->firstElement();
+  ShellC_Element* addElem = stringList->firstElement();
+  const char* addString = addElem->name;
   unsigned int addLength = 0;
   unsigned int inputLenght = strlen(begin);
 
+  // Determin the longest Match
   if (addString != NULL)
     addLength = strlen(addString);
-  tIterator<const char>* charIterator = stringList->getIterator();
-  const char* charElem = charIterator->firstElement();
+  tIterator<ShellC_Element>* charIterator = stringList->getIterator();
+  ShellC_Element* charElem = charIterator->firstElement();
   while (charElem != NULL)
   {
-    PRINTF(0)(displayAs, charElem);
+    PRINTF(0)(displayAs, charElem->name);
     for (unsigned int i = inputLenght; i < addLength; i++)
-      if (addString[i] != charElem[i])
+      if (addString[i] != charElem->name[i])
       {
        addLength = i;
@@ -267,20 +272,14 @@
 
 /**
- * searches for classes, which beginn with classNameBegin
+ * searches for classes, which beginn with completionBegin
  * @param inputList the List to parse through
- * @param classNameBegin the beginning string
- * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
+ * @param completionBegin the beginning string
  * !! The strings MUST NOT be deleted !!
  */
-const tList<const char>* ShellCompletion::createCompleteList(const tList<const char>* inputList, const char* classNameBegin)
-{
-  if (inputList == NULL || classNameBegin == NULL)
+const tList<ShellC_Element>* ShellCompletion::addToCompleteList(const tList<const char>* inputList, const char* completionBegin)
+{
+  if (inputList == NULL || completionBegin == NULL)
     return NULL;
-  unsigned int searchLength = strlen(classNameBegin);
-  if (this->completionList != NULL)
-    delete this->completionList;
-  this->completionList = new tList<const char>;
-
-//  tList<const char>* classList = ClassList::getClassList();
+  unsigned int searchLength = strlen(completionBegin);
 
   tIterator<const char>* iterator = inputList->getIterator();
@@ -289,8 +288,10 @@
   {
     if (strlen(enumString) >= searchLength &&
-        !strncasecmp(enumString, classNameBegin, searchLength))
+        !strncasecmp(enumString, completionBegin, searchLength))
     {
       printf("%s\n", enumString);
-      this->completionList->add(enumString);
+      ShellC_Element* newElem = new ShellC_Element;
+      newElem->name = enumString;
+      this->completionList->add(newElem);
     }
     enumString = iterator->nextElement();
@@ -302,18 +303,14 @@
 
 /**
- * searches for classes, which beginn with classNameBegin
+ * searches for classes, which beginn with completionBegin
  * @param inputList the List to parse through
- * @param classNameBegin the beginning string
- * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards,
+ * @param completionBegin the beginning string
  * !! The strings MUST NOT be deleted !!
  */
-const tList<const char>* ShellCompletion::createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin)
-{
-  if (inputList == NULL || classNameBegin == NULL)
+const tList<ShellC_Element>* ShellCompletion::addToCompleteList(const tList<BaseObject>* inputList, const char* completionBegin)
+{
+  if (inputList == NULL || completionBegin == NULL)
     return NULL;
-  unsigned int searchLength = strlen(classNameBegin);
-  if (this->completionList != NULL)
-    delete this->completionList;
-  this->completionList = new tList<const char>;
+  unsigned int searchLength = strlen(completionBegin);
 
   tIterator<BaseObject>* iterator = inputList->getIterator();
@@ -323,7 +320,9 @@
     if (enumBO->getName() != NULL &&
         strlen(enumBO->getName()) >= searchLength &&
-        !strncasecmp(enumBO->getName(), classNameBegin, searchLength))
-    {
-      this->completionList->add(enumBO->getName());
+        !strncasecmp(enumBO->getName(), completionBegin, searchLength))
+    {
+      ShellC_Element* newElem = new ShellC_Element;
+      newElem->name = enumBO->getName();
+      this->completionList->add(newElem);
     }
     enumBO = iterator->nextElement();
@@ -333,2 +332,18 @@
   return this->completionList;
 }
+
+void ShellCompletion::emptyCompletionList()
+{
+  if (this->completionList != NULL)
+  {
+    tIterator<ShellC_Element>* elemIT = this->completionList->getIterator();
+    ShellC_Element* elem = elemIT->firstElement();
+    while (elem != NULL)
+    {
+      delete elem;
+      elem = elemIT->nextElement();
+    }
+    delete this->completionList;
+  }
+  this->completionList = new tList<ShellC_Element>;
+}
Index: /trunk/src/lib/shell/shell_completion.h
===================================================================
--- /trunk/src/lib/shell/shell_completion.h	(revision 5186)
+++ /trunk/src/lib/shell/shell_completion.h	(revision 5187)
@@ -15,4 +15,16 @@
 #endif
 
+typedef enum {
+  SHELLC_CLASS,
+  SHELLC_OBJECT,
+  SHELLC_FUNCTION,
+  SHELLC_ALIAS,
+} SHELL_CTYPE;
+
+struct ShellC_Element{
+  const char*     name;     //!<
+  SHELL_CTYPE     type;
+};
+
 //! A class for ...
 class ShellCompletion {
@@ -30,13 +42,14 @@
   bool functionMatch(const char* functionBegin, long classID, unsigned int* length);
 
-  bool generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL);
+  bool generalComplete(const tList<ShellC_Element>* stringList, const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL);
 
-  const tList<const char>* createCompleteList(const tList<const char>* inputList, const char* classNameBegin);
-  const tList<const char>* createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin);
-//    const tList<const char>* createCompleteList(const tList<ShellCommandBase>* inputList, const char* classNameBegin);
+  const tList<ShellC_Element>* addToCompleteList(const tList<const char>* inputList, const char* completionBegin);
+  const tList<ShellC_Element>* addToCompleteList(const tList<BaseObject>* inputList, const char* completionBegin);
+  void emptyCompletionList();
+//    const tList<const char>* createCompleteList(const tList<ShellCommandBase>* inputList, const char* completionBegin);
 
 
  private:
-   tList<const char>*       completionList;          //!< A list of completions, that are io.
+   tList<ShellC_Element>*   completionList;          //!< A list of completions, that are io.
    ShellInput*              input;
 };
