1
0
Fork 0
forked from fte/fteqw

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:
Spoike 2013-04-13 13:41:02 +00:00
parent a70446c69b
commit 8b3541b9b4

View file

@ -275,6 +275,16 @@ void CompleteCommand (qboolean force)
if (*s == '\\' || *s == '/') if (*s == '\\' || *s == '/')
s++; s++;
for (cmd = s; *cmd; cmd++)
{
if (*cmd == ' ' || *cmd == '\t')
break;
}
if (*cmd)
cmd = s;
else
{
//check for singular matches and complete if found
cmd = Cmd_CompleteCommand (s, true, true, 2, NULL); cmd = Cmd_CompleteCommand (s, true, true, 2, NULL);
if (!cmd || force) if (!cmd || force)
{ {
@ -302,40 +312,41 @@ void CompleteCommand (qboolean force)
if (desc) if (desc)
Con_Footerf(false, "%s: %s", cmd, desc); Con_Footerf(false, "%s: %s", cmd, desc);
else
Con_Footerf(false, "");
return; return;
} }
} }
/* cmd = Cmd_CompleteCommand (s, false, true, 0, &desc); //complete to a partial match.
cmd = Cmd_CompleteCommand (s, false, true, 0, &desc);
if (cmd) if (cmd)
{ {
int i = key_lines[edit_line][1] == '/'?2:1; int i = key_lines[edit_line][1] == '/'?2:1;
if (i != 2 || strcmp(key_lines[edit_line]+i, cmd)) if (i != 2 || strcmp(key_lines[edit_line]+i, cmd))
{ //if changed, complete it { //if successful, use that instead.
key_lines[edit_line][1] = '/'; Key_ClearTyping();
Q_strcpy (key_lines[edit_line]+2, cmd); Key_ConsoleInsert("/");
key_linepos = Q_strlen(cmd)+2; Key_ConsoleInsert(cmd);
s = key_lines[edit_line]+1; //readjust to cope with the insertion of a / s = key_lines[edit_line]+1; //readjust to cope with the insertion of a /
if (*s == '\\' || *s == '/') if (*s == '\\' || *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 ();