summaryrefslogtreecommitdiff
path: root/source/prompt.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2009-03-24 14:54:32 +0000
committerAndrey Nazarov <skuller@skuller.net>2009-03-24 14:54:32 +0000
commit385ccd0e9a518933019a8c6f1fecad2ae660b766 (patch)
tree6b86f96c16a6d89a5803fce5081af64ac76165ab /source/prompt.c
parentfd8cba03f93046e892a732da27f221406f726b7c (diff)
Implemented a workaround for Q2 pmove bug resulting in swimming velocity in ‘z’ direction being heavily dependent of client's FPS when ‘+moveup’ is used.
New minor Q2PRO protocol version 1015. Fixed command completion mode cursor positioning. Disable ‘cl_updaterate’ variable until it is fully supported. Added ‘sv_waterjump_hack’ variable, enabling the pmove bug workaround described above for supported clients. Properly count connected MVD spectators in menus. Update MVD menus as spectators join/leave the channels.
Diffstat (limited to 'source/prompt.c')
-rw-r--r--source/prompt.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/prompt.c b/source/prompt.c
index 49f5e0a..df4148a 100644
--- a/source/prompt.c
+++ b/source/prompt.c
@@ -160,6 +160,7 @@ void Prompt_CompleteCommand( commandPrompt_t *prompt, qboolean backslash ) {
genctx_t ctx;
char *matches[MAX_MATCHES], *sortedMatches[MAX_MATCHES];
int numCommands = 0, numCvars = 0, numAliases = 0;
+ extern size_t cmd_string_tail;
text = inputLine->text;
size = inputLine->maxChars + 1;
@@ -180,13 +181,13 @@ void Prompt_CompleteCommand( commandPrompt_t *prompt, qboolean backslash ) {
argc = Cmd_Argc();
+ // determine argument number to be completed
currentArg = Cmd_FindArgForOffset( pos );
- len = strlen( text );
- if( len > 0 && text[ len - 1 ] == ' ' ) {
- if( currentArg == argc - 1 ) {
- currentArg++;
- }
+ if( currentArg == argc - 1 && cmd_string_tail ) {
+ // start completing new argument if command line has trailing whitespace
+ currentArg++;
}
+
argnum = 0;
s = Cmd_Argv( 0 );
for( i = 0; i < currentArg; i++ ) {
@@ -236,6 +237,13 @@ void Prompt_CompleteCommand( commandPrompt_t *prompt, qboolean backslash ) {
text += pos;
size -= pos;
+ // append whitespace since Cmd_TokenizeString eats it
+ if( currentArg == argc && cmd_string_tail ) {
+ *text++ = ' ';
+ pos++;
+ size--;
+ }
+
if( ctx.count == 1 ) {
// we have finished completion!
s = Cmd_RawArgsFrom( currentArg + 1 );