fix a few input issues.
ctrl+tab completes the suggested text (ctrl+space still does). escape works again to bring up the menu (oops) partial command completion works again. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4317 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
a70446c69b
commit
8b3541b9b4
1 changed files with 64 additions and 53 deletions
|
@ -275,67 +275,78 @@ void CompleteCommand (qboolean force)
|
||||||
if (*s == '\\' || *s == '/')
|
if (*s == '\\' || *s == '/')
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
cmd = Cmd_CompleteCommand (s, true, true, 2, NULL);
|
for (cmd = s; *cmd; cmd++)
|
||||||
if (!cmd || force)
|
|
||||||
{
|
{
|
||||||
if (!force)
|
if (*cmd == ' ' || *cmd == '\t')
|
||||||
cmd = Cmd_CompleteCommand (s, false, true, 1, &desc);
|
break;
|
||||||
else
|
}
|
||||||
cmd = Cmd_CompleteCommand (s, true, true, con_commandmatch, &desc);
|
if (*cmd)
|
||||||
|
cmd = s;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//check for singular matches and complete if found
|
||||||
|
cmd = Cmd_CompleteCommand (s, true, true, 2, NULL);
|
||||||
|
if (!cmd || force)
|
||||||
|
{
|
||||||
|
if (!force)
|
||||||
|
cmd = Cmd_CompleteCommand (s, false, true, 1, &desc);
|
||||||
|
else
|
||||||
|
cmd = Cmd_CompleteCommand (s, true, true, con_commandmatch, &desc);
|
||||||
|
if (cmd)
|
||||||
|
{
|
||||||
|
//complete to that (maybe partial) cmd.
|
||||||
|
Key_ClearTyping();
|
||||||
|
Key_ConsoleInsert("/");
|
||||||
|
Key_ConsoleInsert(cmd);
|
||||||
|
s = key_lines[edit_line]+2;
|
||||||
|
|
||||||
|
//if its the only match, add a space ready for arguments.
|
||||||
|
cmd = Cmd_CompleteCommand (s, true, true, 0, NULL);
|
||||||
|
if (cmd && !strcmp(s, cmd))
|
||||||
|
{
|
||||||
|
Key_ConsoleInsert(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!con_commandmatch)
|
||||||
|
con_commandmatch = 1;
|
||||||
|
|
||||||
|
if (desc)
|
||||||
|
Con_Footerf(false, "%s: %s", cmd, desc);
|
||||||
|
else
|
||||||
|
Con_Footerf(false, "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//complete to a partial match.
|
||||||
|
cmd = Cmd_CompleteCommand (s, false, true, 0, &desc);
|
||||||
if (cmd)
|
if (cmd)
|
||||||
{
|
{
|
||||||
//complete to that (maybe partial) cmd.
|
int i = key_lines[edit_line][1] == '/'?2:1;
|
||||||
Key_ClearTyping();
|
if (i != 2 || strcmp(key_lines[edit_line]+i, cmd))
|
||||||
Key_ConsoleInsert("/");
|
{ //if successful, use that instead.
|
||||||
Key_ConsoleInsert(cmd);
|
Key_ClearTyping();
|
||||||
s = key_lines[edit_line]+2;
|
Key_ConsoleInsert("/");
|
||||||
|
Key_ConsoleInsert(cmd);
|
||||||
|
|
||||||
//if its the only match, add a space ready for arguments.
|
s = key_lines[edit_line]+1; //readjust to cope with the insertion of a /
|
||||||
cmd = Cmd_CompleteCommand (s, true, true, 0, NULL);
|
if (*s == '\\' || *s == '/')
|
||||||
if (cmd && !strcmp(s, cmd))
|
s++;
|
||||||
{
|
|
||||||
Key_ConsoleInsert(" ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!con_commandmatch)
|
|
||||||
con_commandmatch = 1;
|
|
||||||
|
|
||||||
if (desc)
|
|
||||||
Con_Footerf(false, "%s: %s", cmd, desc);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* cmd = Cmd_CompleteCommand (s, false, true, 0, &desc);
|
|
||||||
if (cmd)
|
|
||||||
{
|
|
||||||
int i = key_lines[edit_line][1] == '/'?2:1;
|
|
||||||
if (i != 2 || strcmp(key_lines[edit_line]+i, cmd))
|
|
||||||
{ //if changed, complete it
|
|
||||||
key_lines[edit_line][1] = '/';
|
|
||||||
Q_strcpy (key_lines[edit_line]+2, cmd);
|
|
||||||
key_linepos = Q_strlen(cmd)+2;
|
|
||||||
|
|
||||||
s = key_lines[edit_line]+1; //readjust to cope with the insertion of a /
|
|
||||||
if (*s == '\\' || *s == '/')
|
|
||||||
s++;
|
|
||||||
|
|
||||||
key_lines[edit_line][key_linepos] = 0;
|
|
||||||
|
|
||||||
if (!con_commandmatch)
|
|
||||||
con_commandmatch = 1;
|
|
||||||
|
|
||||||
if (desc)
|
|
||||||
Con_Footerf(false, "%s: %s", cmd, desc);
|
|
||||||
|
|
||||||
return; //don't alter con_commandmatch if we compleated a tiny bit more
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
con_commandmatch++;
|
con_commandmatch++;
|
||||||
if (Cmd_CompleteCommand(s, true, true, con_commandmatch, &desc))
|
cmd = Cmd_CompleteCommand(s, true, true, con_commandmatch, &desc);
|
||||||
|
if (!cmd)
|
||||||
|
{
|
||||||
|
con_commandmatch = 1;
|
||||||
|
cmd = Cmd_CompleteCommand(s, true, true, con_commandmatch, &desc);
|
||||||
|
}
|
||||||
|
if (cmd)
|
||||||
{
|
{
|
||||||
if (desc)
|
if (desc)
|
||||||
Con_Footerf(false, "%s: %s", cmd, desc);
|
Con_Footerf(false, "%s: %s", cmd, desc);
|
||||||
|
else
|
||||||
|
Con_Footerf(false, "");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -974,14 +985,14 @@ void Key_Console (unsigned int unicode, int key)
|
||||||
|
|
||||||
if (key == K_TAB)
|
if (key == K_TAB)
|
||||||
{ // command completion
|
{ // command completion
|
||||||
if (keydown[K_CTRL] || keydown[K_SHIFT])
|
if (keydown[K_SHIFT])
|
||||||
{
|
{
|
||||||
Con_CycleConsole();
|
Con_CycleConsole();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (con_current->commandcompletion)
|
if (con_current->commandcompletion)
|
||||||
CompleteCommand (false);
|
CompleteCommand (keydown[K_CTRL]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (key != K_CTRL && key != K_SHIFT && con_commandmatch)
|
if (key != K_CTRL && key != K_SHIFT && con_commandmatch)
|
||||||
|
@ -1939,7 +1950,7 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case key_console:
|
case key_console:
|
||||||
if (cls.state)
|
if (cls.state && key_dest == key_console)
|
||||||
key_dest = key_game;
|
key_dest = key_game;
|
||||||
else
|
else
|
||||||
M_ToggleMenu_f ();
|
M_ToggleMenu_f ();
|
||||||
|
|
Loading…
Reference in a new issue