Skip to content

Commit

Permalink
Merge pull request #10 from rschristian/fix/stopProgressionIfNoStaged…
Browse files Browse the repository at this point in the history
…Changes

refactor: Stop progression from file prompt if nothing selected
  • Loading branch information
brigand committed Oct 2, 2020
2 parents 42306ed + ccb7032 commit bada6fa
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 bada6fa

Please sign in to comment.