Skip to content

Commit

Permalink
Merge pull request #273 from Gordon01/history_first
Browse files Browse the repository at this point in the history
Record input to history before validation
  • Loading branch information
pksunkara committed Aug 29, 2023
2 parents dfd6e22 + 3aa3aaa commit 44cb900
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/prompts/input.rs
Expand Up @@ -592,18 +592,18 @@ where

match input.parse::<T>() {
Ok(value) => {
#[cfg(feature = "history")]
if let Some(history) = &mut self.history {
history.write(&value);
}

if let Some(ref mut validator) = self.validator {
if let Some(err) = validator(&value) {
render.error(&err)?;
continue;
}
}

#[cfg(feature = "history")]
if let Some(history) = &mut self.history {
history.write(&value);
}

if self.report {
if let Some(post_completion_text) = &self.post_completion_text {
render.input_prompt_selection(post_completion_text, &input)?;
Expand Down

0 comments on commit 44cb900

Please sign in to comment.