Fixed buffer length in history manipulation.

Writing new chars must be done with default attribute (not cell
current attribute).
This commit is contained in:
Eric Pouech 2001-12-21 20:29:10 +00:00 committed by Alexandre Julliard
parent d547450b35
commit c19bb1ab3f
2 changed files with 4 additions and 4 deletions

View File

@ -1379,9 +1379,9 @@ int CONSOLE_GetHistory(int idx, WCHAR* buf, int buf_len)
{
req->handle = 0;
req->index = idx;
if (buf && buf_len > sizeof(WCHAR))
if (buf && buf_len > 1)
{
wine_server_set_reply( req, buf, buf_len - sizeof(WCHAR) );
wine_server_set_reply( req, buf, (buf_len - 1) * sizeof(WCHAR) );
}
if (!wine_server_call_err( req ))
{

View File

@ -175,8 +175,8 @@ static void WCEL_InsertString(WCEL_Context* ctx, const WCHAR* str)
memcpy(&ctx->line[ctx->ofs], str, len * sizeof(WCHAR));
ctx->len += len;
ctx->line[ctx->len] = 0;
WriteConsoleOutputCharacterW(ctx->hConOut, &ctx->line[ctx->ofs], ctx->len - ctx->ofs,
WCEL_GetCoord(ctx, ctx->ofs), NULL);
SetConsoleCursorPosition(ctx->hConOut, WCEL_GetCoord(ctx, ctx->ofs));
WriteConsoleW(ctx->hConOut, &ctx->line[ctx->ofs], ctx->len - ctx->ofs, NULL, NULL);
ctx->ofs += len;
}