1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-16 08:42:23 +00:00

Console autocompletion: List candidates when repeatedly pressing tab (bash-style)

This commit is contained in:
scrawl 2014-05-02 22:19:02 +02:00
parent 92467ba6bc
commit df1694c27b

View File

@ -215,16 +215,22 @@ namespace MWGui
{ {
std::vector<std::string> matches; std::vector<std::string> matches;
listNames(); listNames();
mCommandLine->setCaption(complete( mCommandLine->getOnlyText(), matches )); std::string oldCaption = mCommandLine->getCaption();
#if 0 std::string newCaption = complete( mCommandLine->getOnlyText(), matches );
int i = 0; mCommandLine->setCaption(newCaption);
for(std::vector<std::string>::iterator it=matches.begin(); it < matches.end(); ++it,++i )
// List candidates if repeatedly pressing tab
if (oldCaption == newCaption && matches.size())
{ {
printOK( *it ); int i = 0;
if( i == 50 ) printOK("");
break; for(std::vector<std::string>::iterator it=matches.begin(); it < matches.end(); ++it,++i )
{
printOK( *it );
if( i == 50 )
break;
}
} }
#endif
} }
if(mCommandHistory.empty()) return; if(mCommandHistory.empty()) return;