Skip to content

Commit

Permalink
Don't add empty prompt input to history (helix-editor#3259)
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Walrus authored and GreasySlug committed Aug 2, 2022
1 parent c35baa9 commit 3889cd8
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 3889cd8

Please sign in to comment.