i= MAX_INPUTLINE - key_linepos - 1;
if (i > 0)
{
- // terencehill: insert the clipboard text between the characters of the line
- /*
- char *temp = (char *) Z_Malloc(MAX_INPUTLINE);
- cbd[i]=0;
- temp[0]=0;
- if ( key_linepos < (int)strlen(key_line) )
- strlcpy(temp, key_line + key_linepos, (int)strlen(key_line) - key_linepos +1);
- key_line[key_linepos] = 0;
- strlcat(key_line, cbd, sizeof(key_line));
- if (temp[0])
- strlcat(key_line, temp, sizeof(key_line));
- Z_Free(temp);
- key_linepos += i;
- */
- // blub: I'm changing this to use memmove() like the rest of the code does.
cbd[i] = 0;
memmove(key_line + key_linepos + i, key_line + key_linepos, sizeof(key_line) - key_linepos - i);
memcpy(key_line + key_linepos, cbd, i);
Key_History_Down();
return;
}
- // ~1.0795 = 82/76 using con_textsize 64 76 is height of the char, 6 is the distance between 2 lines
if (keydown[K_CTRL])
{
// check insert mode, or always insert if at end of line
if (key_insert || len == 0)
{
+ if (key_linepos + len + blen >= MAX_INPUTLINE)
+ return;
// can't use strcpy to move string to right
len++;
- //memmove(&key_line[key_linepos + u8_bytelen(key_line + key_linepos, 1)], &key_line[key_linepos], len);
+ if (key_linepos + blen + len >= MAX_INPUTLINE)
+ return;
memmove(&key_line[key_linepos + blen], &key_line[key_linepos], len);
}
+ else if (key_linepos + len + blen - u8_bytelen(key_line + key_linepos, 1) >= MAX_INPUTLINE)
+ return;
memcpy(key_line + key_linepos, buf, blen);
+ if (blen > len)
+ key_line[key_linepos + blen] = 0;
+ // END OF FIXME
key_linepos += blen;
- //key_linepos += u8_fromchar(unicode, key_line + key_linepos, sizeof(key_line) - key_linepos - 1);
- //key_line[key_linepos] = ascii;
- //key_linepos++;
}
}
return;
}
- if (ascii == 0x80 && utf8_enable.integer) // pressing AltGr-5 (or AltGr-e) and for some reason we get windows-1252 encoding?
- ascii = 0x20AC; // we want the Euro currency sign
- // TODO find out which vid_ drivers do it and fix it there
- // but catching U+0080 here is no loss as that char is not useful anyway
-
// get key binding
bind = keybindings[key_bmap][key];
if (!bind)
if(key_consoleactive)
keydest = key_console;
-
+
if (down)
{
// increment key repeat count each time a down is received so that things
if(keydest == key_void)
return;
-
+
// key_consoleactive is a flag not a key_dest because the console is a
// high priority overlay ontop of the normal screen (designed as a safety
// feature so that developers and users can rescue themselves from a bad
{
if (down && con_closeontoggleconsole.integer && bind && !strncmp(bind, "toggleconsole", strlen("toggleconsole")) && ascii != STRING_COLOR_TAG)
{
- Con_ToggleConsole_f ();
+ Cbuf_AddText("toggleconsole\n"); // Deferred to next frame so we're not sending the text event to the console.
tbl_keydest[key] = key_void; // key release should go nowhere (especially not to key_menu or key_game)
return;
}