mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-23 12:32:14 +00:00
cvar and cmd auto-completion tweaks
'h' indicates more help is available '?' indicates a cvar is user-created muted the Com_sprintf overflow warnings
This commit is contained in:
parent
69efe163ac
commit
a61c6f0e47
2 changed files with 13 additions and 9 deletions
|
@ -2726,11 +2726,12 @@ static void PrintCmdMatches( const char *s )
|
|||
const char* desc;
|
||||
const char* help;
|
||||
Cmd_GetHelp( &desc, &help, s );
|
||||
|
||||
const char h = help != NULL ? 'h' : ' ';
|
||||
|
||||
if ( desc )
|
||||
Com_sprintf( msg, sizeof(msg), " "COLOR_CMD"%s - "COLOR_HELP"%s\n", s, desc );
|
||||
Com_sprintf( msg, sizeof(msg), " %c "COLOR_CMD"%s - "COLOR_HELP"%s\n", h, s, desc );
|
||||
else
|
||||
Com_sprintf( msg, sizeof(msg), " "COLOR_CMD"%s\n", s );
|
||||
Com_sprintf( msg, sizeof(msg), " %c "COLOR_CMD"%s\n", h, s );
|
||||
|
||||
Com_TruncatePrintString( msg, sizeof(msg), CONSOLE_WIDTH );
|
||||
Com_Printf( msg );
|
||||
|
@ -2746,10 +2747,13 @@ static void PrintCvarMatches( const char *s )
|
|||
const char* desc;
|
||||
const char* help;
|
||||
Cvar_GetHelp( &desc, &help, s );
|
||||
const char h = help != NULL ? 'h' : ' ';
|
||||
const char u = ( Cvar_Flags(s) & CVAR_USER_CREATED ) != 0 ? '?' : h;
|
||||
|
||||
if ( desc )
|
||||
Com_sprintf( msg, sizeof(msg), " "COLOR_CVAR"%s^7 = \""COLOR_VAL"%s^7\" - "COLOR_HELP"%s\n", s, Cvar_VariableString( s ), desc );
|
||||
Com_sprintf( msg, sizeof(msg), " %c "COLOR_CVAR"%s^7 = \""COLOR_VAL"%s^7\" - "COLOR_HELP"%s\n", u, s, Cvar_VariableString( s ), desc );
|
||||
else
|
||||
Com_sprintf( msg, sizeof(msg), " "COLOR_CVAR"%s^7 = \""COLOR_VAL"%s^7\"\n", s, Cvar_VariableString( s ) );
|
||||
Com_sprintf( msg, sizeof(msg), " %c "COLOR_CVAR"%s^7 = \""COLOR_VAL"%s^7\"\n", u, s, Cvar_VariableString( s ) );
|
||||
|
||||
Com_TruncatePrintString( msg, sizeof(msg), CONSOLE_WIDTH );
|
||||
Com_Printf( msg );
|
||||
|
|
|
@ -652,13 +652,13 @@ void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
|
|||
if ( len >= sizeof( bigbuffer ) ) {
|
||||
Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" );
|
||||
}
|
||||
// don't spam overflow warnings to end-users, especially since it's a perfectly normal
|
||||
// thing to happen with command and cvar auto-completion
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
if (len >= size) {
|
||||
Com_Printf ("Com_sprintf: overflow of %i in %i\n", len, size);
|
||||
#if defined(_DEBUG) && defined(_MSC_VER)
|
||||
if (IsDebuggerPresent())
|
||||
__debugbreak();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
Q_strncpyz (dest, bigbuffer, size );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue