From: Thomas Csovcsity <thc.fr13nd@gmail.com> --- dlls/kernel32/tests/console.c | 4 ++-- programs/conhost/conhost.c | 40 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 8c35d5786b1..6f1bb6a0474 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -5768,8 +5768,8 @@ static void test_ANSI_escape_sequences(void) ret = WriteConsoleW(hConOut, L"\x1b[1;1H", 6, &dw, NULL); ok(dw == 6, "Wrong count\n"); ret = GetConsoleScreenBufferInfo(hConOut, &sb_info); - todo_wine ok(sb_info.dwCursorPosition.X == 0, "Incorrect X cursor position: got %d, expected %d\n", sb_info.dwCursorPosition.X, 0); - todo_wine ok(sb_info.dwCursorPosition.Y == 0, "Incorrect Y cursor position\n: got %d, expected %d\n", sb_info.dwCursorPosition.Y, 0); + ok(sb_info.dwCursorPosition.X == 0, "Incorrect X cursor position: got %d, expected %d\n", sb_info.dwCursorPosition.X, 0); + ok(sb_info.dwCursorPosition.Y == 0, "Incorrect Y cursor position\n: got %d, expected %d\n", sb_info.dwCursorPosition.Y, 0); ok(sb_info.wAttributes == (FOREGROUND_RED | BACKGROUND_BLUE), "Unexpected attributes: got %x, expected %x\n", sb_info.wAttributes, FOREGROUND_RED | BACKGROUND_BLUE); CloseHandle(hConOut); diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 04252459a80..0f8d0bb058f 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -2300,6 +2300,46 @@ static void process_csi_sequence_console( struct screen_buffer *screen_buffer, c set_output_info( screen_buffer, &info_params, sizeof(info_params) ); } break; + case 'H': + unsigned int x = 0, y = 0, value = 0, i; + TRACE( "This is an CUP seq with %Iu length and [%s] as payload! seq_p %p\n",len, debugstr_wn( seq, len ), seq ); + + for (i = 0; i < len; i++) + { + if (seq[i] != ';' && seq[i] != 'H') + value = 10 * value + seq[i] - '0'; + else if (seq[i] == ';') + { + if (value != 0) + { + y = value; + value = 0; + } + else + y = 1; + } + else if (seq[i] == 'H') + { + if (y == 0 && value == 0) + { + x = 1; + y = 1; + } else if (y == 0 && value != 0) + { + y = value; + x = 1; + } else /* (y != 0 && value != 0) */ + x = value; + } + else + { + ERR( "CSI CUP parsing failed, this should not happen!\n" ); + break; + } + } + screen_buffer->cursor_x = x-1; + screen_buffer->cursor_y = y-1; + break; default: FIXME( "unhandled sequence %s switch char [%s] len[%Iu]\n", debugstr_wn( seq, len ), debugstr_wn( &seq[len], 1 ), len ); break; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9973