Changeset 7235 for code/branches/consolecommands3/src/libraries/core/command/ArgumentCompletionFunctions.cc
- Timestamp:
- Aug 28, 2010, 1:25:04 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/command/ArgumentCompletionFunctions.cc
r7234 r7235 69 69 } 70 70 71 ArgumentCompletionList _groupsandcommands( bool bOnlyShowHidden)71 ArgumentCompletionList _groupsandcommands(const std::string& fragment, bool bOnlyShowHidden) 72 72 { 73 73 ArgumentCompletionList groupList; 74 std::string fragmentLC = getLowercase(fragment); 74 75 75 76 const std::map<std::string, std::map<std::string, _ConsoleCommand*> >& commands = _ConsoleCommand::getCommands(); 76 77 for (std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group) 77 if (groupIsVisible(it_group->second, bOnlyShowHidden) && it_group->first != "" )78 if (groupIsVisible(it_group->second, bOnlyShowHidden) && it_group->first != "" && (fragmentLC == "" || getLowercase(it_group->first).find_first_of(fragmentLC) == 0)) 78 79 groupList.push_back(ArgumentCompletionListElement(it_group->first, getLowercase(it_group->first))); 79 80 … … 81 82 if (it_group != commands.end()) 82 83 { 83 groupList.push_back(ArgumentCompletionListElement("", "", "\n")); 84 if (!groupList.empty()) 85 groupList.push_back(ArgumentCompletionListElement("", "", "\n")); 84 86 85 87 for (std::map<std::string, _ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command) 86 if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden )88 if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(it_command->first).find_first_of(fragmentLC) == 0)) 87 89 groupList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first))); 88 90 } 91 92 if (!groupList.empty() && groupList.back().getDisplay() == "\n") 93 groupList.pop_back(); 89 94 90 95 return groupList; … … 113 118 } 114 119 115 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(groupsandcommands)( )116 { 117 return detail::_groupsandcommands(f alse);120 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(groupsandcommands)(const std::string& fragment) 121 { 122 return detail::_groupsandcommands(fragment, false); 118 123 } 119 124 … … 128 133 const std::string& hint = evaluation.hint(); 129 134 130 if (evaluation.getPossibleArguments().size() > 0 )135 if (evaluation.getPossibleArguments().size() > 0 && evaluation.getPossibleArgumentsSize() > 0) 131 136 { 132 137 return evaluation.getPossibleArguments(); … … 145 150 146 151 if (tokens.size() == 0) 147 return detail::_groupsandcommands( true);152 return detail::_groupsandcommands(fragment, true); 148 153 149 154 if (_ConsoleCommand::getCommandLC(getLowercase(tokens[0]))) … … 156 161 return detail::_subcommands(fragment, tokens[0], true); 157 162 else 158 return detail::_groupsandcommands( true);163 return detail::_groupsandcommands(fragment, true); 159 164 } 160 165
Note: See TracChangeset
for help on using the changeset viewer.