* Overhaul of console autocompletion
- No longer does weird stuff like move the cursor inappropriately - Autocomplete works with compound commands - Special autocomplete on some commands e.g. \map, \demo - Removed various hacks used to counter the original autocomplete code
This commit is contained in:
parent
893629fb0f
commit
c3f7915a8b
8 changed files with 340 additions and 103 deletions
|
@ -3426,3 +3426,26 @@ void FS_Flush( fileHandle_t f ) {
|
|||
fflush(fsh[f].handleFiles.file.o);
|
||||
}
|
||||
|
||||
void FS_FilenameCompletion( const char *dir, const char *ext,
|
||||
qboolean stripExt, void(*callback)(const char *s) ) {
|
||||
char **filenames;
|
||||
int nfiles;
|
||||
int i;
|
||||
char filename[ MAX_STRING_CHARS ];
|
||||
|
||||
filenames = FS_ListFilteredFiles( dir, ext, NULL, &nfiles );
|
||||
|
||||
FS_SortFileList( filenames, nfiles );
|
||||
|
||||
for( i = 0; i < nfiles; i++ ) {
|
||||
FS_ConvertPath( filenames[ i ] );
|
||||
Q_strncpyz( filename, filenames[ i ], MAX_STRING_CHARS );
|
||||
|
||||
if( stripExt ) {
|
||||
COM_StripExtension( filename, filename );
|
||||
}
|
||||
|
||||
callback( filename );
|
||||
}
|
||||
FS_FreeFileList( filenames );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue