Browse Source

engine: console: sort output in commmand autocomplete for bind

pull/2/head
Alibek Omarov 5 years ago
parent
commit
364c96f45c
  1. 22
      engine/common/con_utils.c

22
engine/common/con_utils.c

@ -598,6 +598,16 @@ static void Con_AddCommandToList( const char *s, const char *unused1, const char @@ -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 ) @@ -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 @@ -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

Loading…
Cancel
Save