Skip to content

Commit 50ccfcd

Browse files
authored
Update read_line behaviour to read_line_initial_text (#181)
1 parent 072f9f7 commit 50ccfcd

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/term.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,7 @@ impl Term {
284284
/// This does not include the trailing newline. If the terminal is not
285285
/// user attended the return value will always be an empty string.
286286
pub fn read_line(&self) -> io::Result<String> {
287-
if !self.is_tty {
288-
return Ok("".into());
289-
}
290-
let mut rv = String::new();
291-
io::stdin().read_line(&mut rv)?;
292-
let len = rv.trim_end_matches(&['\r', '\n'][..]).len();
293-
rv.truncate(len);
294-
Ok(rv)
287+
self.read_line_initial_text("")
295288
}
296289

297290
/// Read one line of input with initial text.

0 commit comments

Comments
 (0)