diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 97dc9c61ce8..deb50305538 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3950,6 +3950,8 @@ static void test_AllocConsole(void) static void test_pseudo_console_child(HANDLE input, HANDLE output) { + CONSOLE_SCREEN_BUFFER_INFO sb_info; + CONSOLE_CURSOR_INFO cursor_info; DWORD mode; BOOL ret; @@ -3985,6 +3987,25 @@ static void test_pseudo_console_child(HANDLE input, HANDLE output) ret = SetConsoleMode(output, mode | ENABLE_WRAP_AT_EOL_OUTPUT); ok(ret, "SetConsoleMode failed: %u\n", GetLastError()); + ret = GetConsoleScreenBufferInfo(output, &sb_info); + ok(ret, "GetConsoleScreenBufferInfo failed: %u\n", GetLastError()); + ok(sb_info.dwSize.X == 40, "dwSize.X = %u\n", sb_info.dwSize.X); + ok(sb_info.dwSize.Y == 30, "dwSize.Y = %u\n", sb_info.dwSize.Y); + ok(sb_info.dwCursorPosition.X == 0, "dwCursorPosition.X = %u\n", sb_info.dwCursorPosition.X); + ok(sb_info.dwCursorPosition.Y == 0, "dwCursorPosition.Y = %u\n", sb_info.dwCursorPosition.Y); + ok(sb_info.wAttributes == 7, "wAttributes = %x\n", sb_info.wAttributes); + ok(sb_info.srWindow.Left == 0, "srWindow.Left = %u\n", sb_info.srWindow.Left); + ok(sb_info.srWindow.Top == 0, "srWindow.Top = %u\n", sb_info.srWindow.Top); + ok(sb_info.srWindow.Right == 39, "srWindow.Right = %u\n", sb_info.srWindow.Right); + ok(sb_info.srWindow.Bottom == 29, "srWindow.Bottom = %u\n", sb_info.srWindow.Bottom); + ok(sb_info.dwMaximumWindowSize.X == 40, "dwMaximumWindowSize.X = %u\n", sb_info.dwMaximumWindowSize.X); + ok(sb_info.dwMaximumWindowSize.Y == 30, "dwMaximumWindowSize.Y = %u\n", sb_info.dwMaximumWindowSize.Y); + + ret = GetConsoleCursorInfo(output, &cursor_info); + ok(ret, "GetConsoleCursorInfo failed: %u\n", GetLastError()); + ok(cursor_info.dwSize == 25, "dwSize = %u\n", cursor_info.dwSize); + ok(cursor_info.bVisible == TRUE, "bVisible = %x\n", cursor_info.bVisible); + test_console_title(); test_WriteConsoleInputW(input); } diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 8f09ebbb3f6..b91c81a5e5b 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -184,19 +184,30 @@ static struct screen_buffer *create_screen_buffer( struct console *console, int screen_buffer->console = console; screen_buffer->id = id; screen_buffer->mode = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT; - screen_buffer->cursor_size = 100; + screen_buffer->cursor_size = 25; screen_buffer->cursor_visible = 1; screen_buffer->width = width; screen_buffer->height = height; screen_buffer->attr = 0x07; screen_buffer->popup_attr = 0xf5; - screen_buffer->max_width = 80; - screen_buffer->max_height = 25; - screen_buffer->win.right = min( screen_buffer->max_width - 1, width - 1 ); - screen_buffer->win.bottom = min( screen_buffer->max_height - 1, height - 1); screen_buffer->font.weight = FW_NORMAL; screen_buffer->font.pitch_family = FIXED_PITCH | FF_DONTCARE; + if (console->active) + { + screen_buffer->max_width = console->active->max_width; + screen_buffer->max_height = console->active->max_height; + screen_buffer->win.right = console->active->win.right - console->active->win.left; + screen_buffer->win.bottom = console->active->win.bottom - console->active->win.top; + } + else + { + screen_buffer->max_width = width; + screen_buffer->max_height = height; + screen_buffer->win.right = width - 1; + screen_buffer->win.bottom = height - 1; + } + if (wine_rb_put( &screen_buffer_map, LongToPtr(id), &screen_buffer->entry )) { free( screen_buffer );