From: havoc Date: Thu, 12 Jan 2006 15:17:12 +0000 (+0000) Subject: added console editing enhancements patch from [515], except the part for special... X-Git-Tag: xonotic-v0.1.0preview~4392 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3f928aa8b5eae2c8a2b93c99205ba31a8682af60;p=xonotic%2Fdarkplaces.git added console editing enhancements patch from [515], except the part for special quake characters was omitted (as the engine should not assume the quake font is being used) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5901 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/keys.c b/keys.c index b9083439..0be40b50 100644 --- a/keys.c +++ b/keys.c @@ -326,12 +326,29 @@ Key_Console (int key, char ascii) // Advanced Console Editing by Radix radix@planetquake.com // Added/Modified by EvilTypeGuy eviltypeguy@qeradiant.com + // Enhanced by [515] // left arrow will just move left one without erasing, backspace will // actually erase charcter if (key == K_LEFTARROW || key == K_KP_LEFTARROW) { - if (key_linepos > 1) + if (key_linepos < 2) + return; + if(keydown[K_CTRL]) + { + int pos; + char k; + pos = key_linepos-1; + if(pos) + while(--pos) + { + k = key_lines[edit_line][pos]; + if(k == '\"' || k == ';' || k == ' ' || k == '\'') + break; + } + key_linepos = pos + 1; + } + else key_linepos--; return; } @@ -360,9 +377,24 @@ Key_Console (int key, char ascii) // otherwise just go right one if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW) { - if (key_linepos < (int)strlen(key_lines[edit_line])) + if (key_linepos >= (int)strlen(key_lines[edit_line])) + return; + if(keydown[K_CTRL]) + { + int pos, len; + char k; + len = (int)strlen(key_lines[edit_line]); + pos = key_linepos; + while(++pos < len) + { + k = key_lines[edit_line][pos]; + if(k == '\"' || k == ';' || k == ' ' || k == '\'') + break; + } + key_linepos = pos; + } + else key_linepos++; - return; } @@ -421,13 +453,19 @@ Key_Console (int key, char ascii) if (key == K_HOME || key == K_KP_HOME) { - con_backscroll = con_totallines - (vid_conheight.integer>>3) - 1; + if (keydown[K_CTRL]) + con_backscroll = con_totallines - (vid_conheight.integer>>3) - 1; + else + key_linepos = 1; return; } if (key == K_END || key == K_KP_END) { - con_backscroll = 0; + if (keydown[K_CTRL]) + con_backscroll = 0; + else + key_linepos = strlen(key_lines[edit_line]); return; }