Skip to content

Commit

Permalink
Don't add empty prompt input to history (#3259)
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Walrus authored Jul 30, 2022
1 parent a8b123f commit 5ca98ed
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions helix-term/src/ui/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,16 +533,17 @@ impl Component for Prompt {
.map(|entry| entry.into())
.unwrap_or_else(|| Cow::from(""))
} else {
if let Some(register) = self.history_register {
// store in history
let register = cx.editor.registers.get_mut(register);
register.push(self.line.clone());
}

self.line.as_str().into()
};

(self.callback_fn)(cx, &input, PromptEvent::Validate);

if let Some(register) = self.history_register {
// store in history
let register = cx.editor.registers.get_mut(register);
register.push(self.line.clone());
}
return close_fn;
}
}
Expand Down

0 comments on commit 5ca98ed

Please sign in to comment.