Skip to content

Commit

Permalink
Merge pull request #39 from u32int/main
Browse files Browse the repository at this point in the history
Close some TODOs
  • Loading branch information
Samyak2 committed Jun 28, 2022
2 parents 08a3e04 + ae820a2 commit 063fc4f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ pub struct ToipeConfig {
pub wordlist: BuiltInWordlist,
/// Path to custom word list file.
///
/// Providing this will override `-w`/`--wordlist`.
// TODO: find a way to ensure `-w` isn't provided along with this.
#[clap(short = 'f', long = "file")]
/// This argument cannot be used along with `-w`/`--wordlist`
#[clap(short = 'f', long = "file", conflicts_with = "wordlist")]
pub wordlist_file: Option<String>,
/// Number of words to show on each test.
#[clap(short, long, default_value_t = 30)]
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ impl<'a> Toipe {
let mut to_restart: Option<bool> = None;
while to_restart.is_none() {
match keys.next().unwrap()? {
// press 'r' to restart
// press ctrl + 'r' to restart
Key::Ctrl('r') => to_restart = Some(true),
// press 'q' to quit
// press ctrl + 'c' to quit
Key::Ctrl('c') => to_restart = Some(false),
_ => {}
}
Expand Down
9 changes: 4 additions & 5 deletions src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,31 +483,31 @@ impl ToipeTui {
Ok(())
}

// TODO: document this
/// Moves the cursor to the next char
pub fn move_to_next_char(&mut self) -> MaybeError {
let (x, y) = self.cursor_pos.next();
write!(self.stdout, "{}", cursor::Goto(x, y))?;

Ok(())
}

// TODO: document this
/// Moves the cursor to the previous char
pub fn move_to_prev_char(&mut self) -> MaybeError {
let (x, y) = self.cursor_pos.prev();
write!(self.stdout, "{}", cursor::Goto(x, y))?;

Ok(())
}

// TODO: document this
/// Moves the cursor to just before the character to be typed next
pub fn move_to_cur_pos(&mut self) -> MaybeError {
let (x, y) = self.cursor_pos.cur_pos();
write!(self.stdout, "{}", cursor::Goto(x, y))?;

Ok(())
}

// TODO: document this
/// Returns the current line the cursor is on
pub fn current_line(&self) -> usize {
self.cursor_pos.cur_line
}
Expand All @@ -524,7 +524,6 @@ impl Drop for ToipeTui {
///
/// Clears screen and sets the cursor to a non-blinking block.
///
/// TODO: reset cursor to whatever it was before Toipe was started.
/// TODO: print error message when terminal height/width is too small.
/// Take a look at https://github.com/Samyak2/toipe/pull/28#discussion_r851784291 for more info.
fn drop(&mut self) {
Expand Down

0 comments on commit 063fc4f

Please sign in to comment.