aboutsummaryrefslogtreecommitdiff
path: root/src/terminal_modes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/terminal_modes.rs')
-rw-r--r--src/terminal_modes.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/terminal_modes.rs b/src/terminal_modes.rs
index b38d251b..e6b15d36 100644
--- a/src/terminal_modes.rs
+++ b/src/terminal_modes.rs
@@ -1,8 +1,7 @@
use std::io::{self, Write};
-#[cfg(any(not(windows), test))]
const DISABLE_HOST_MOUSE_REPORTING_SEQUENCE: &[u8] =
- b"\x1b[?1006l\x1b[?1016l\x1b[?1015l\x1b[?1005l\x1b[?1003l\x1b[?1002l\x1b[?1000l";
+ b"\x1b[?1006l\x1b[?1016l\x1b[?1015l\x1b[?1005l\x1b[?1003l\x1b[?1002l\x1b[?1000l\x1b[?9l";
#[cfg(any(windows, test))]
const WINDOWS_SSH_MOUSE_REPORTING_ENABLE_SEQUENCE: &[u8] =
@@ -11,17 +10,11 @@ const WINDOWS_SSH_MOUSE_REPORTING_ENABLE_SEQUENCE: &[u8] =
const WINDOWS_SSH_MOUSE_REPORTING_DISABLE_SEQUENCE: &[u8] =
b"\x1b[?1016l\x1b[?1006l\x1b[?1003l\x1b[?1002l\x1b[?1000l";
-#[cfg(not(windows))]
pub(crate) fn clear_host_mouse_reporting<W: Write>(writer: &mut W) -> io::Result<()> {
writer.write_all(DISABLE_HOST_MOUSE_REPORTING_SEQUENCE)?;
writer.flush()
}
-#[cfg(windows)]
-pub(crate) fn clear_host_mouse_reporting<W: Write>(_writer: &mut W) -> io::Result<()> {
- Ok(())
-}
-
#[cfg(any(windows, test))]
pub(crate) fn set_windows_ssh_mouse_reporting<W: Write>(
writer: &mut W,
@@ -182,9 +175,11 @@ mod tests {
#[test]
fn clears_all_known_host_mouse_modes() {
- let sequence = std::str::from_utf8(DISABLE_HOST_MOUSE_REPORTING_SEQUENCE).unwrap();
+ let mut output = Vec::new();
+ clear_host_mouse_reporting(&mut output).unwrap();
+ let sequence = std::str::from_utf8(&output).unwrap();
- for mode in ["1000", "1002", "1003", "1005", "1006", "1015", "1016"] {
+ for mode in ["9", "1000", "1002", "1003", "1005", "1006", "1015", "1016"] {
assert!(
sequence.contains(&format!("\x1b[?{mode}l")),
"missing mouse mode {mode}"