Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7415 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Apr 28, 2006, 1:30:13 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Super-good completion :), and extremely tired bensch

Location:
trunk/src/lib/shell
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_command.cc

    r7414 r7415  
    184184      {
    185185        retCmd = ShellCommand::getCommand(strings[2], cmdClass);
    186         paramBegin = 3;
     186          paramBegin = 3;
    187187      }
    188188      if (retCmd != NULL) // check for the paramBegin.
  • trunk/src/lib/shell/shell_completion.cc

    r7414 r7415  
    5656    long completeType = NullCompletion;              //< the Type we'd like to complete.
    5757    std::string completeString = "";                 //< the string to complete.
    58     unsigned int parameterBegin = 0;                 //< The SubString-entry, the Parameters begin.
     58    unsigned int completeParam = 0;                  //< The Parameter to finish.
    5959    const ShellCommand* command = NULL;              //< The Command.
    6060
     
    102102    if (completeType == NullCompletion)
    103103    {
    104 
     104      unsigned int parameterBegin = parameterBegin;
    105105      if ((command = ShellCommand::getCommandFromInput(inputSplits, parameterBegin)) != NULL)
    106106        completeType |= ParamCompletion;
     107      if (emptyComplete)
     108        completeParam = inputSplits.size() - parameterBegin;
     109      else
     110        completeParam = inputSplits.size() - parameterBegin - 1;
    107111    }
    108112
     
    116120      this->aliasComplete(completeString);
    117121    if (completeType & ParamCompletion)
    118       this->paramComplete(completeString, command);
     122      this->paramComplete(completeString, command, completeParam);
    119123
    120124    this->generalComplete(input, completeString);
     
    177181   * @returns true on succes, false if something went wrong
    178182   */
    179   bool ShellCompletion::paramComplete(const std::string& paramBegin, const ShellCommand* command)
    180   {
     183  bool ShellCompletion::paramComplete(const std::string& paramBegin, const ShellCommand* command, unsigned int paramNumber)
     184  {
     185    if (paramNumber >= command->getParamCount())
     186    {
     187      PRINT(0)("Last Parameter reached\n");
     188      return false;
     189    }
    181190    std::vector<std::string> completed;
    182     command->getCompletorPlugin(0)->addToCompleteList(completed, paramBegin);
    183       for (unsigned int i = 0; i < completed.size(); i++)
    184         this->completionList.push_back(CompletionElement(completed[i], ParamCompletion));
     191    command->getCompletorPlugin(paramNumber)->addToCompleteList(completed, paramBegin);
     192    for (unsigned int i = 0; i < completed.size(); i++)
     193      this->completionList.push_back(CompletionElement(completed[i], ParamCompletion));
     194    return true;
    185195  }
    186196
  • trunk/src/lib/shell/shell_completion.h

    r7413 r7415  
    5656      bool commandComplete(const std::string& commandBegin, const std::string& className);
    5757      bool aliasComplete(const std::string& aliasBegin);
    58       bool paramComplete(const std::string& paramBegin, const ShellCommand* command);
     58      bool paramComplete(const std::string& paramBegin, const ShellCommand* command, unsigned int paramNumber);
    5959
    6060      // Generally Completes.
Note: See TracChangeset for help on using the changeset viewer.