mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Use memmove instead of strcpy when deleting chars.
It seems recent(?) 64-bit strcpy implementations of strcpy don't work properly for overlapping regions even when moving down. Quite the surprise, as I thought that would always work. *shrug*
This commit is contained in:
parent
7b231bc70e
commit
415decb983
1 changed files with 6 additions and 5 deletions
|
@ -116,15 +116,16 @@ Con_ProcessInputLine (inputline_t *il, int ch)
|
|||
break;
|
||||
case QFK_BACKSPACE:
|
||||
if (il->linepos > 1) {
|
||||
strcpy (il->lines[il->edit_line] + il->linepos - 1,
|
||||
il->lines[il->edit_line] + il->linepos);
|
||||
char *pos = il->lines[il->edit_line] + il->linepos - 1;
|
||||
memmove (pos, pos + 1, strlen (pos + 1) + 1);
|
||||
il->linepos--;
|
||||
}
|
||||
break;
|
||||
case QFK_DELETE:
|
||||
if (il->linepos < strlen (il->lines[il->edit_line]))
|
||||
strcpy (il->lines[il->edit_line] + il->linepos,
|
||||
il->lines[il->edit_line] + il->linepos + 1);
|
||||
if (il->linepos < strlen (il->lines[il->edit_line])) {
|
||||
char *pos = il->lines[il->edit_line] + il->linepos;
|
||||
memmove (pos, pos + 1, strlen (pos + 1) + 1);
|
||||
}
|
||||
break;
|
||||
case QFK_RIGHT:
|
||||
if (il->linepos < strlen (il->lines[il->edit_line]))
|
||||
|
|
Loading…
Reference in a new issue