- { // command completion
- cmd = Cmd_CompleteCommand (key_lines[edit_line]+1);
- if (!cmd)
- cmd = Cvar_CompleteVariable (key_lines[edit_line]+1);
- if (cmd)
+ {
+ // Enhanced command completion
+ // by EvilTypeGuy eviltypeguy@qeradiant.com
+ // Thanks to Fett, Taniwha
+ Con_CompleteCommandLine();
+ }
+
+ // Advanced Console Editing by Radix radix@planetquake.com
+ // Added/Modified by EvilTypeGuy eviltypeguy@qeradiant.com
+
+ // left arrow will just move left one without erasing, backspace will
+ // actually erase charcter
+ if (key == K_LEFTARROW)
+ {
+ if (key_linepos > 1)
+ key_linepos--;
+ return;
+ }
+
+ if (key == K_BACKSPACE) // delete char before cursor
+ {
+ if (key_linepos > 1)
+ {
+ strcpy(key_lines[edit_line] + key_linepos - 1, key_lines[edit_line] + key_linepos);
+ key_linepos--;
+ }
+ return;
+ }
+
+ if (key == K_DEL) // delete char on cursor
+ {
+ if (key_linepos < strlen(key_lines[edit_line]))
+ strcpy(key_lines[edit_line] + key_linepos, key_lines[edit_line] + key_linepos + 1);
+ return;
+ }
+
+
+ // if we're at the end, get one character from previous line,
+ // otherwise just go right one
+ if (key == K_RIGHTARROW)
+ {
+ if (strlen(key_lines[edit_line]) == key_linepos)