Skip to content

Commit

Permalink
Merge pull request #12 from rschristian/fix/typesPrompt
Browse files Browse the repository at this point in the history
  • Loading branch information
brigand committed Oct 2, 2020
2 parents bada6fa + 1d92214 commit e472ac2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/prompt/type_prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ impl<'a> TypePrompt<'a> {
self.focused_index = self.focused_index.saturating_sub(1);
}
Some((KeyCode::Down, false, _, false)) => {
let total = self.config.types.len() as u16;

self.focused_index += 1;
if self.focused_index >= total {
self.focused_index = total.saturating_sub(1);
}
}
None => {}
_ => continue,
Expand All @@ -116,7 +121,7 @@ impl<'a> TypePrompt<'a> {
style(s).with(Color::Magenta).to_string()
});

let y_offset = header.len() as u16;
let y_offset = header.len() as u16 + 1;

for line in header {
buffer.push_line(line);
Expand All @@ -126,6 +131,7 @@ impl<'a> TypePrompt<'a> {
let prompt_pre = "Choose a type: ";
let prompt_post = &self.input;
let underscores = "_".repeat(6 - self.input.len());
buffer.push_line("");
buffer.push_line(format!(
"{}{}{}{}",
prompt_pre,
Expand Down

0 comments on commit e472ac2

Please sign in to comment.