conhost: Update tty output in fill_output.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-09-04 13:51:35 +02:00 committed by Alexandre Julliard
parent 4100c43576
commit cd193e44a5
2 changed files with 48 additions and 0 deletions

View File

@ -883,6 +883,18 @@ static NTSTATUS fill_output( struct screen_buffer *screen_buffer, const struct c
return STATUS_INVALID_PARAMETER;
}
if (count && is_active(screen_buffer))
{
RECT update_rect;
SetRect( &update_rect,
params->x % screen_buffer->width,
params->y + params->x / screen_buffer->width,
(params->x + i - 1) % screen_buffer->width,
params->y + (params->x + i - 1) / screen_buffer->width );
update_output( screen_buffer, &update_rect );
tty_sync( screen_buffer->console );
}
if (!(result = alloc_ioctl_buffer( sizeof(*result) ))) return STATUS_NO_MEMORY;
*result = count;
return STATUS_SUCCESS;

View File

@ -145,6 +145,7 @@ static BOOL expect_erase_line_(unsigned line, unsigned int cnt)
enum req_type
{
REQ_FILL_CHAR,
REQ_SET_CURSOR,
REQ_SET_TITLE,
REQ_WRITE_CHARACTERS,
@ -171,6 +172,12 @@ struct pseudoconsole_req
SMALL_RECT region;
CHAR_INFO buf[1];
} write_output;
struct
{
WCHAR ch;
DWORD count;
COORD coord;
} fill;
} u;
};
@ -252,6 +259,20 @@ static void child_write_output_(unsigned int line, CHAR_INFO *buf, unsigned int
ok_(__FILE__,line)(region.Bottom == out_bottom, "Bottom = %u\n", region.Bottom);
}
static void child_fill_character(WCHAR ch, DWORD count, int x, int y)
{
struct pseudoconsole_req req;
BOOL ret;
req.type = REQ_FILL_CHAR;
req.u.fill.ch = ch;
req.u.fill.count = count;
req.u.fill.coord.X = x;
req.u.fill.coord.Y = y;
ret = WriteFile(child_pipe, &req, sizeof(req), &count, NULL);
ok(ret, "WriteFile failed: %u\n", GetLastError());
}
static void test_tty_output(void)
{
CHAR_INFO char_info_buf[2048], char_info;
@ -463,6 +484,15 @@ static void test_tty_output(void)
expect_output_sequence("\x1b[4;3H"); /* set cursor */
expect_output_sequence("\x1b[?25h"); /* show cursor */
expect_empty_output();
child_fill_character('i', 5, 15, 16);
expect_hide_cursor();
expect_output_sequence("\x1b[m"); /* default attributes */
expect_output_sequence("\x1b[17;16H"); /* set cursor */
expect_output_sequence("iiiii");
expect_output_sequence("\x1b[4;3H"); /* set cursor */
expect_output_sequence("\x1b[?25h"); /* show cursor */
expect_empty_output();
}
static void child_process(HANDLE pipe)
@ -483,6 +513,12 @@ static void child_process(HANDLE pipe)
const struct pseudoconsole_req *req = (void *)buf;
switch (req->type)
{
case REQ_FILL_CHAR:
ret = FillConsoleOutputCharacterW(output, req->u.fill.ch, req->u.fill.count, req->u.fill.coord, &count);
ok(ret, "FillConsoleOutputCharacter failed: %u\n", GetLastError());
ok(count == req->u.fill.count, "count = %u, expected %u\n", count, req->u.fill.count);
break;
case REQ_SET_CURSOR:
ret = SetConsoleCursorPosition(output, req->u.coord);
ok(ret, "SetConsoleCursorPosition failed: %u\n", GetLastError());