diff --git a/CHANGELOG.md b/CHANGELOG.md index ecc08a7..69b3890 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# Version 0.17.7 +- Fix cursor position retrieval bug linux. + # Version 0.17.6 - Add functionality to retrieve color based on passed ansi code. - Switch from 'futures' to 'futures-util' crate to reduce dependency count diff --git a/Cargo.toml b/Cargo.toml index f99e3d8..1024cb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossterm" -version = "0.17.6" +version = "0.17.7" authors = ["T. Post"] description = "An crossplatform terminal library for manipulating terminals." repository = "https://github.com/crossterm-rs/crossterm" diff --git a/src/event/source/unix.rs b/src/event/source/unix.rs index 9b3c5ce..bd6755c 100644 --- a/src/event/source/unix.rs +++ b/src/event/source/unix.rs @@ -79,7 +79,16 @@ impl EventSource for UnixInternalEventSource { let timeout = PollTimeout::new(timeout); loop { - self.poll.poll(&mut self.events, timeout.leftover())?; + if let Err(e) = self.poll.poll(&mut self.events, timeout.leftover()) { + // Mio will throw an interrupted error in case of cursor position retrieval. We need to retry until it succeeds. + // Previous versions of Mio (< 0.7) would automatically retry the poll call if it was interrupted (if EINTR was returned). + // https://docs.rs/mio/0.7.0/mio/struct.Poll.html#notes + if e.kind() == io::ErrorKind::Interrupted { + continue; + } else { + return Err(ErrorKind::IoError(e)); + } + }; if self.events.is_empty() { // No readiness events = timeout