engine: console: sort output in commmand autocomplete for bind

This commit is contained in:
Alibek Omarov 2019-07-09 15:10:32 +03:00
parent 7aa163f713
commit 364c96f45c
1 changed files with 12 additions and 10 deletions

View File

@ -598,6 +598,16 @@ static void Con_AddCommandToList( const char *s, const char *unused1, const char
list->cmds[list->matchCount++] = copystring( s );
}
/*
=================
Con_SortCmds
=================
*/
static int Con_SortCmds( const void *arg1, const void *arg2 )
{
return Q_stricmp( *(const char **)arg1, *(const char **)arg2 );
}
/*
=====================================
Cmd_GetCommandsList
@ -632,6 +642,8 @@ qboolean Cmd_GetCommandsList( const char *s, char *completedname, int length )
Q_strncpy( completedname, matchbuf, length );
if( list.matchCount == 1 ) return true;
qsort( list.cmds, list.matchCount, sizeof( char* ), Con_SortCmds );
for( i = 0; i < list.matchCount; i++ )
{
Q_strncpy( matchbuf, list.cmds[i], sizeof( matchbuf ));
@ -1026,16 +1038,6 @@ qboolean Cmd_AutocompleteName( const char *source, int arg, char *buffer, size_t
return false;
}
/*
=================
Con_SortCmds
=================
*/
static int Con_SortCmds( const void *arg1, const void *arg2 )
{
return Q_stricmp( *(const char **)arg1, *(const char **)arg2 );
}
/*
===============
Con_PrintCmdMatches