[Orxonox-commit 1448] r6166 - code/branches/presentation2/src/libraries/core

rgrieder at orxonox.net rgrieder at orxonox.net
Thu Nov 26 18:49:36 CET 2009


Author: rgrieder
Date: 2009-11-26 18:49:35 +0100 (Thu, 26 Nov 2009)
New Revision: 6166

Modified:
   code/branches/presentation2/src/libraries/core/ArgumentCompletionFunctions.cc
   code/branches/presentation2/src/libraries/core/CommandExecutor.cc
Log:
Fixed auto completion:
- When completing for instance "KeyBin", it was extended to "keybinder" instead of "KeyBinder" ("KeyBinderManager" has the same casing)
- "keybinder " didn't show the config values for the KeyBinder (occurred often because of the issue above)

Modified: code/branches/presentation2/src/libraries/core/ArgumentCompletionFunctions.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/ArgumentCompletionFunctions.cc	2009-11-26 17:06:26 UTC (rev 6165)
+++ code/branches/presentation2/src/libraries/core/ArgumentCompletionFunctions.cc	2009-11-26 17:49:35 UTC (rev 6166)
@@ -100,8 +100,8 @@
             ArgumentCompletionList classlist;
 
             for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapBegin(); it != Identifier::getStringIdentifierMapEnd(); ++it)
-                if ((*it).second->hasConfigValues())
-                    classlist.push_back(ArgumentCompletionListElement((*it).second->getName(), getLowercase((*it).first)));
+                if (it->second->hasConfigValues())
+                    classlist.push_back(ArgumentCompletionListElement(it->first, getLowercase(it->first)));
 
             return classlist;
         }
@@ -109,12 +109,12 @@
         ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(configvalues)(const std::string& fragment, const std::string& classname)
         {
             ArgumentCompletionList configvalues;
-            std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getStringIdentifierMap().find(classname);
+            std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseStringIdentifierMap().find(getLowercase(classname));
 
-            if (identifier != Identifier::getStringIdentifierMapEnd() && (*identifier).second->hasConfigValues())
+            if (identifier != Identifier::getLowercaseStringIdentifierMapEnd() && identifier->second->hasConfigValues())
             {
-                for (std::map<std::string, ConfigValueContainer*>::const_iterator it = (*identifier).second->getConfigValueMapBegin(); it != (*identifier).second->getConfigValueMapEnd(); ++it)
-                    configvalues.push_back(ArgumentCompletionListElement((*it).second->getName(), getLowercase((*it).first)));
+                for (std::map<std::string, ConfigValueContainer*>::const_iterator it = identifier->second->getConfigValueMapBegin(); it != identifier->second->getConfigValueMapEnd(); ++it)
+                    configvalues.push_back(ArgumentCompletionListElement(it->first, getLowercase(it->first)));
             }
 
             return configvalues;
@@ -126,10 +126,10 @@
             std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseStringIdentifierMap().find(getLowercase(classname));
             if (identifier != Identifier::getLowercaseStringIdentifierMapEnd())
             {
-                std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
-                if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
+                std::map<std::string, ConfigValueContainer*>::const_iterator variable = identifier->second->getLowercaseConfigValueMap().find(getLowercase(varname));
+                if (variable != identifier->second->getLowercaseConfigValueMapEnd())
                 {
-                    std::string valuestring = (*variable).second->toString();
+                    std::string valuestring = variable->second->toString();
                     oldvalue.push_back(ArgumentCompletionListElement(valuestring, getLowercase(valuestring), "Old value: " + valuestring));
                 }
             }

Modified: code/branches/presentation2/src/libraries/core/CommandExecutor.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/CommandExecutor.cc	2009-11-26 17:06:26 UTC (rev 6165)
+++ code/branches/presentation2/src/libraries/core/CommandExecutor.cc	2009-11-26 17:49:35 UTC (rev 6166)
@@ -636,20 +636,25 @@
             std::string output = "";
             for (unsigned int i = 0; true; i++)
             {
+                char tempComparable = 0;
                 char temp = 0;
                 for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
                 {
-                    std::string argument = (*it).getComparable();
+                    std::string argumentComparable = (*it).getComparable();
+                    std::string argument = (*it).getString();
                     if (argument.size() > i)
                     {
                         if (it == list.begin())
                         {
+                            tempComparable = argumentComparable[i];
                             temp = argument[i];
                         }
                         else
                         {
-                            if (temp != argument[i])
+                            if (tempComparable != argumentComparable[i])
                                 return output;
+                            else if (temp != argument[i])
+                                temp = tempComparable;
                         }
                     }
                     else




More information about the Orxonox-commit mailing list