Fix buffer inconsistency un ^U

darcs-hash:20051209024034-ac50b-a06c78f8f238f61c99ddcd4bee02f8b41af26c6c.gz
This commit is contained in:
axel 2005-12-09 12:40:34 +10:00
parent fe5bf8f80e
commit e2ed5d0977

View File

@ -2586,10 +2586,13 @@ wchar_t *reader_readline()
case R_BACKWARD_KILL_LINE:
{
wchar_t prev = data->buff[data->buff_pos];
data->buff[data->buff_pos]=0;
kill_add( data->buff );
data->buff[data->buff_pos]=prev;
wchar_t *str = wcsndup( data->buff, data->buff_pos );
if( !str )
die_mem();
kill_add( str );
free( str );
data->buff_len = wcslen(data->buff +data->buff_pos);
memmove( data->buff, data->buff +data->buff_pos, sizeof(wchar_t)*data->buff_len );
data->buff[data->buff_len]=L'\0';