Skip to content

Commit 67f3a88

Browse files
fix(terminal): force ANSI fallback for cursor key commands on windows (#1952)
1 parent 34cb74f commit 67f3a88

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

crates/forge_select/src/terminal.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ impl Command for DisableApplicationCursorKeys {
117117
fn write_ansi(&self, f: &mut impl std::fmt::Write) -> std::fmt::Result {
118118
write!(f, "\x1b[?1l")
119119
}
120+
121+
#[cfg(windows)]
122+
fn execute_winapi(&self) -> std::io::Result<()> {
123+
Err(std::io::Error::new(
124+
std::io::ErrorKind::Unsupported,
125+
"not supported on Windows, using ANSI fallback",
126+
))
127+
}
120128
}
121129

122130
/// Custom crossterm command to enable application cursor keys mode
@@ -128,4 +136,12 @@ impl Command for EnableApplicationCursorKeys {
128136
fn write_ansi(&self, f: &mut impl std::fmt::Write) -> std::fmt::Result {
129137
write!(f, "\x1b[?1h")
130138
}
139+
140+
#[cfg(windows)]
141+
fn execute_winapi(&self) -> std::io::Result<()> {
142+
Err(std::io::Error::new(
143+
std::io::ErrorKind::Unsupported,
144+
"not supported on Windows, using ANSI fallback",
145+
))
146+
}
131147
}

0 commit comments

Comments
 (0)