From d178de278a7a8c73f5c8c8b61def5e13e07ece2c Mon Sep 17 00:00:00 2001 From: Takashi Yano <takashi.yano@nifty.ne.jp> Date: Mon, 12 Aug 2019 22:48:45 +0900 Subject: [PATCH] Cygwin: console: Fix cursor position restore after screen alternation. - If screen is alternated on console, cursor position is not restored correctly in the case of xterm compatible mode is enabled. For example, the shell prompt is shown at incorrect position after using vim. This patch fixes this problem. --- winsup/cygwin/fhandler_console.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index b46a4d513..4afb7efb7 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -308,6 +308,9 @@ void fhandler_console::set_cursor_maybe () { con.fillin (get_output_handle ()); + /* Nothing to do for xterm compatible mode. */ + if (wincap.has_con_24bit_colors ()) + return; if (con.dwLastCursorPosition.X != con.b.dwCursorPosition.X || con.dwLastCursorPosition.Y != con.b.dwCursorPosition.Y) {