From ee064a0c798dd5617d253be7d26aa41f924bab96 Mon Sep 17 00:00:00 2001 From: Can Celik Date: Tue, 15 Sep 2026 17:24:35 +0300 Subject: fix(windows): preserve sgr mouse encoding after native capture (#4195) refs #4155 --- src/terminal_modes.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/terminal_modes.rs') diff --git a/src/terminal_modes.rs b/src/terminal_modes.rs index 810fa871..11bf56fc 100644 --- a/src/terminal_modes.rs +++ b/src/terminal_modes.rs @@ -26,12 +26,10 @@ pub(crate) fn set_windows_mouse_reporting( } else { WINDOWS_MOUSE_REPORTING_DISABLE_SEQUENCE })?; - if enabled { - writer.write_all(if sgr_pixels { - b"\x1b[?1016h" - } else { - b"\x1b[?1016l" - })?; + // The caller clears modes before native capture. Resetting 1016 here can + // undo the SGR encoding that ConPTY has already enabled on the host. + if enabled && sgr_pixels { + writer.write_all(b"\x1b[?1016h")?; } writer.flush() } @@ -197,7 +195,7 @@ mod tests { assert_eq!( output, - b"\x1b[?1000h\x1b[?1002h\x1b[?1003h\x1b[?1006h\x1b[?1016h\x1b[?1000h\x1b[?1002h\x1b[?1003h\x1b[?1006h\x1b[?1016l\x1b[?1016l\x1b[?1006l\x1b[?1003l\x1b[?1002l\x1b[?1000l" + b"\x1b[?1000h\x1b[?1002h\x1b[?1003h\x1b[?1006h\x1b[?1016h\x1b[?1000h\x1b[?1002h\x1b[?1003h\x1b[?1006h\x1b[?1016l\x1b[?1006l\x1b[?1003l\x1b[?1002l\x1b[?1000l" ); } } -- cgit v1.2.3