[PATCH] Cygwin: pty: Fix cursor position on new nat app in existing pcon

Takashi Yano <[email protected]> Tue, 21 Jul 2026 05:07:52 +0900
Newsgroups gmane.os.cygwin.patches
Message-ID <[email protected]>
Previously, the steps: cmd.exe -> bash -> cmd.exe exhibit broken
cursor position even with the commit b34394d456b6 ("Cygwin: pty:
Fixup pty state after a cygwin app exits").

This patch sets req_fixup_pcon_cur_pos also when reusing existing
pseudo console as well as req_xfer_input.

Signed-off-by: Takashi Yano <[email protected]>
Reviewed-by:
---
 winsup/cygwin/fhandler/pty.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index f3df55f34..a100c868e 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -3850,6 +3850,7 @@ fhandler_pty_slave::setup_pseudoconsole ()
 	  WaitForSingleObject (input_mutex, mutex_timeout);
 	  get_ttyp ()->req_xfer_input = true; /* indicates that this "ESC[6n"
 						 is just for transfer input */
+	  get_ttyp ()->req_fixup_pcon_cur_pos = true;
 	  get_ttyp ()->pcon_start = true;
 	  get_ttyp ()->pcon_start_pid = myself->pid;
 	  WriteFile (get_output_handle (), "\033[6n", 4, &n, NULL);
-- 
2.51.0