fix(windows): use 1-based cursor position (closes #1065)

This commit is contained in:
Loric ANDRE 2026-05-02 19:39:42 +02:00
parent 19d2640fe1
commit c3bac9f697

View file

@ -253,6 +253,7 @@ impl Drop for RawMode {
}
}
/// Get cursor position, 1-based
#[cfg(unix)]
pub(crate) fn cursor_pos_from_tty() -> io::Result<(u16, u16)> {
let _guard = RawMode::new()?;
@ -309,10 +310,11 @@ pub(crate) fn cursor_pos_from_tty() -> io::Result<(u16, u16)> {
Ok((cx, cy))
}
/// Get cursor position, 1-based
#[cfg(windows)]
pub(crate) fn cursor_pos_from_tty() -> io::Result<(u16, u16)> {
let _guard = RawMode::new()?;
crossterm::cursor::position()
crossterm::cursor::position().map(|(x, y)| (x + 1, y + 1))
}
#[cfg(test)]