Skip to content

Commit

Permalink
Merge pull request #613 from lopopolo/lopopolo/remove-buf_redux-dep
Browse files Browse the repository at this point in the history
Replace `buf_redux` with `BufReader` from `std`
  • Loading branch information
gwenn authored Apr 10, 2022
2 parents 4d48e58 + eb2035b commit 507ffa2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ regex = { version = "1.5.4", optional = true }
nix = "0.23"
utf8parse = "0.2"
skim = { version = "0.9", optional = true }
buf_redux = { version = "0.8", default-features = false }

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["consoleapi", "handleapi", "synchapi", "minwindef", "processenv", "std", "winbase", "wincon", "winuser"] }
Expand Down
7 changes: 3 additions & 4 deletions src/tty/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
use std::cmp;
use std::collections::HashMap;
use std::fs::{File, OpenOptions};
use std::io::{self, ErrorKind, Read, Write};
use std::io::{self, BufReader, ErrorKind, Read, Write};
use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{self, SyncSender};
use std::sync::{self, Arc, Mutex};

use buf_redux::BufReader;
use log::{debug, warn};
use nix::errno::Errno;
use nix::poll::{self, PollFlags};
Expand Down Expand Up @@ -657,7 +656,7 @@ impl PosixRawReader {
}

fn poll(&mut self, timeout_ms: i32) -> ::nix::Result<i32> {
let n = self.tty_in.buf_len();
let n = self.tty_in.buffer().len();
if n > 0 {
return Ok(n as i32);
}
Expand Down Expand Up @@ -732,7 +731,7 @@ impl RawReader for PosixRawReader {

let mut key = KeyEvent::new(c, M::NONE);
if key == E::ESC {
if self.tty_in.buf_len() > 0 {
if !self.tty_in.buffer().is_empty() {
debug!(target: "rustyline", "read buffer {:?}", self.tty_in.buffer());
}
let timeout_ms = if single_esc_abort && self.timeout_ms == -1 {
Expand Down

0 comments on commit 507ffa2

Please sign in to comment.