Skip to content

Commit

Permalink
refactor: Stop progression from file prompt if nothing selected
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Oct 1, 2020
1 parent 42306ed commit ccb7032
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/prompt/files_prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,16 @@ impl<'a> FilesPrompt<'a> {
}
}
Some((KeyCode::Enter, _, _, _)) => {
let selected = self
let selected: Vec<String> = self
.options
.iter()
.enumerate()
.filter_map(|(i, file)| Some(file).filter(|_| self.checked[i]))
.map(Into::into)
.collect();
return FilesPromptResult::Files(selected);
if !selected.is_empty() {
return FilesPromptResult::Files(selected);
}
}

Some((KeyCode::Esc, _, _, _)) => {
Expand Down

0 comments on commit ccb7032

Please sign in to comment.