aboutsummaryrefslogtreecommitdiff
path: root/src/terminal_modes.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-15 17:24:35 +0300
committerGitHub <noreply@github.com>2026-09-15 17:24:35 +0300
commitee064a0c798dd5617d253be7d26aa41f924bab96 (patch)
treeac63fa4f16002c83f3931fc8085bb80923778f96 /src/terminal_modes.rs
parent963f78f46c8f10d0bfc869f0ea13223892a1f0ef (diff)
fix(windows): preserve sgr mouse encoding after native capture (#4195)
refs #4155
Diffstat (limited to 'src/terminal_modes.rs')
-rw-r--r--src/terminal_modes.rs12
1 files changed, 5 insertions, 7 deletions
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<W: Write>(
} 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"
);
}
}