]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
default to insert mode instead of replace mode in console
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 17 Apr 2005 08:37:08 +0000 (08:37 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 17 Apr 2005 08:37:08 +0000 (08:37 +0000)
get rid of stupid cursor right at end of line behavior in console, repeating characters from the previous edit line is annoying
allow typing characters > 126 in console

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5189 d7cf8633-e32d-0410-b094-e92efae38249

keys.c

diff --git a/keys.c b/keys.c
index 91f4f55c52013dc52f974ad7b621c8173c510f20..d069adfa3f9590817e8b09b54c56bde4c6ab271e 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -32,7 +32,7 @@ char          key_lines[32][MAX_INPUTLINE];
 int                    key_linepos;
 static int     ctrl_down = false;
 static int     key_lastpress;
 int                    key_linepos;
 static int     ctrl_down = false;
 static int     key_lastpress;
-int                    key_insert;     // insert key toggle (for editing)
+int                    key_insert = true;      // insert key toggle (for editing)
 
 int         edit_line = 0;
 int         history_line = 0;
 
 int         edit_line = 0;
 int         history_line = 0;
@@ -368,16 +368,7 @@ Key_Console (int key, char ascii)
        // otherwise just go right one
        if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW)
        {
        // otherwise just go right one
        if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW)
        {
-               if (strlen(key_lines[edit_line]) == (size_t)key_linepos)
-               {
-                       if (strlen(key_lines[(edit_line + 31) & 31]) <= (size_t)key_linepos)
-                               return; // no character to get
-
-                       key_lines[edit_line][key_linepos] = key_lines[(edit_line + 31) & 31][key_linepos];
-                       key_linepos++;
-                       key_lines[edit_line][key_linepos] = 0;
-               }
-               else
+               if ((size_t)key_linepos < strlen(key_lines[edit_line]))
                        key_linepos++;
 
                return;
                        key_linepos++;
 
                return;
@@ -456,7 +447,7 @@ Key_Console (int key, char ascii)
        }
 
        // non printable
        }
 
        // non printable
-       if (ascii < 32 || ascii > 126)
+       if (ascii < 32)
                return;
 
        if (key_linepos < MAX_INPUTLINE-1)
                return;
 
        if (key_linepos < MAX_INPUTLINE-1)