Mercurial > hg
changeset 1903:75a0a22bbf78
Fix issue #54 -- command line corruption
Thanks to the Anonymous reporter :)
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 17 Apr 2010 11:21:04 +0200 |
parents | 51cc01a1a5ec |
children | 9a3d7a7dada2 |
files | mcabber/mcabber/screen.c |
diffstat | 1 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/mcabber/screen.c Wed Apr 14 21:27:37 2010 +0200 +++ b/mcabber/mcabber/screen.c Sat Apr 17 11:21:04 2010 +0200 @@ -3141,6 +3141,14 @@ return cmdhisto_backup; } +static char *_strmove(char *dst, const char *src) +{ + char *dest = dst; + while ((*dest++ = *src++) != '\0') + ; + return dest; +} + // readline_transpose_chars() // Drag the character before point forward over the character at // point, moving point forward as well. If point is at the end of @@ -3221,10 +3229,7 @@ // Modify the line ptr_inputline = c; - for (;;) { - *c = *old++; - if (!*c++) break; - } + _strmove(ptr_inputline, old); check_offset(-1); } @@ -3451,9 +3456,7 @@ src = ptr_inputline; c = prev_char(ptr_inputline, inputLine); ptr_inputline = c; - for ( ; *src ; ) - *c++ = *src++; - *c = 0; + _strmove(ptr_inputline, src); check_offset(-1); } @@ -3462,7 +3465,7 @@ if (!*ptr_inputline) return; - strcpy(ptr_inputline, next_char(ptr_inputline)); + _strmove(ptr_inputline, next_char(ptr_inputline)); } void readline_iline_start(void) @@ -3486,7 +3489,7 @@ if (*dest == COMMAND_CHAR && ptr_inputline != dest+1) dest = next_char(dest); - strcpy(dest, ptr_inputline); + _strmove(dest, ptr_inputline); ptr_inputline = dest; inputline_offset = 0; }