Skip to content

Commit

Permalink
Tab completion for the viewpos command
Browse files Browse the repository at this point in the history
This makes the optional `copy` argument more discoverable
  • Loading branch information
andrei-drexler committed Nov 19, 2023
1 parent 20a40e1 commit 6bde823
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Quake/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,18 @@ void CL_Viewpos_f (void)
Con_Printf ("Clipboard copy failed: %s\n", SDL_GetError ());
}

/*
===============
CL_Viewpos_Completion_f -- tab completion for the viewpos command
===============
*/
static void CL_Viewpos_Completion_f (const char *partial)
{
if (Cmd_Argc () != 2)
return;
Con_AddToTabList ("copy", partial, NULL);
}

/*
=============
CL_SetStat_f
Expand Down Expand Up @@ -940,6 +952,8 @@ CL_Init
*/
void CL_Init (void)
{
cmd_function_t *cmd;

SZ_Alloc (&cls.message, 1024);

CL_InitInput ();
Expand Down Expand Up @@ -987,7 +1001,9 @@ void CL_Init (void)
Cmd_AddCommand ("timedemo", CL_TimeDemo_f);

Cmd_AddCommand ("tracepos", CL_Tracepos_f); //johnfitz
Cmd_AddCommand ("viewpos", CL_Viewpos_f); //johnfitz
cmd = Cmd_AddCommand ("viewpos", CL_Viewpos_f); //johnfitz
if (cmd)
cmd->completion = CL_Viewpos_Completion_f;

Cmd_AddCommand_ServerCommand ("st", CL_SetStat_f);
Cmd_AddCommand_ServerCommand ("sts", CL_SetStatString_f);
Expand Down

0 comments on commit 6bde823

Please sign in to comment.