From: Hugh McMaster Subject: [PATCH 2/2] kernel32: Restore the original console cursor size on Enter press, if the Insert key toggle is active Message-Id: Date: Mon, 3 Aug 2015 17:55:01 +1000 Similar to patch 1, the console cursor size is not restored on Enter press. --- dlls/kernel32/editline.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/kernel32/editline.c b/dlls/kernel32/editline.c index 4dfa2cf..f7e42a4 100644 --- a/dlls/kernel32/editline.c +++ b/dlls/kernel32/editline.c @@ -61,6 +61,7 @@ typedef struct WCEL_Context { WCHAR* yanked; /* yanked line */ unsigned mark; /* marked point (emacs mode only) */ CONSOLE_SCREEN_BUFFER_INFO csbi; /* current state (initial cursor, window size, attribute) */ + CONSOLE_CURSOR_INFO cinfo; /* original cursor state (size, visibility) */ HANDLE hConIn; HANDLE hConOut; unsigned done : 1, /* to 1 when we're done with editing */ @@ -485,6 +486,8 @@ static void WCEL_Done(WCEL_Context* ctx) ctx->line[ctx->len++] = '\n'; ctx->line[ctx->len] = 0; WriteConsoleW(ctx->hConOut, &nl, 1, NULL, NULL); + if (ctx->insertkey) + SetConsoleCursorInfo(ctx->hConOut, &ctx->cinfo); ctx->done = 1; } @@ -930,6 +933,7 @@ WCHAR* CONSOLE_Readline(HANDLE hConsoleIn, BOOL can_pos_cursor) if (!GetConsoleMode(ctx.hConOut, &mode)) mode = 0; ctx.can_wrap = (mode & ENABLE_WRAP_AT_EOL_OUTPUT) ? 1 : 0; ctx.can_pos_cursor = can_pos_cursor; + GetConsoleCursorInfo(ctx.hConOut, &ctx.cinfo); if (!WCEL_Grow(&ctx, 1)) { -- 1.9.1