Get position bug fixed (#465)

This commit is contained in:
Timon 2020-07-13 21:32:56 +02:00 committed by GitHub
parent 30b7d99364
commit 6326795700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -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

View File

@ -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"

View File

@ -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