aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorA-Walrus2022-07-30 17:17:01 +0000
committerGitHub2022-07-30 17:17:01 +0000
commit5ca98edfb1b961a9b85dbada0e71036534900be6 (patch)
treeae95c3f355fce411f2b049466ef26edf6143320f /helix-term/src
parenta8b123fe177d8cd7f5a610a0a50c16c9f64069bd (diff)
Don't add empty prompt input to history (#3259)
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/prompt.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index 6e7df907..03920a53 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -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;
}
}