Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crossterm_input test/docstrings fixes #207

Merged
merged 4 commits into from
Sep 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions crossterm_input/src/input/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ impl TerminalInput {
/// Not sure what 'raw mode' is, checkout the 'crossterm_screen' crate.
///
/// # Example
/// ```rust
/// let input = input();
/// match input.read_line() {
/// ```ignore
/// let in = input();
/// match in.read_line() {
/// Ok(s) => println!("string typed: {}", s),
/// Err(e) => println!("error: {}", e),
/// }
/// }
/// ```
pub fn read_line(&self) -> io::Result<String> {
let mut rv = String::new();
Expand All @@ -60,13 +60,12 @@ impl TerminalInput {

/// Read one character from the user input
///
/// ```rust
/// let input = input();
///
/// match input.read_char() {
/// ```ignore
/// let in = input();
/// match in.read_char() {
/// Ok(c) => println!("character pressed: {}", c),
/// Err(e) => println!("error: {}", e),
/// }
/// }
/// ```
pub fn read_char(&self) -> io::Result<char> {
self.input.read_char()
Expand Down
4 changes: 2 additions & 2 deletions crossterm_input/src/input/unix_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@ where
#[test]
fn test_parse_utf8() {
let st = "abcéŷ¤£€ù%323";
let ref mut bytes = st.bytes().map(|x| Ok(x));
let ref mut bytes = st.bytes();
let chars = st.chars();
for c in chars {
let b = bytes.next().unwrap().unwrap();
let b = bytes.next().unwrap();
assert_eq!(c, parse_utf8_char(b, bytes).unwrap());
}
}