Don't add empty prompt input to history (#3259)

This commit is contained in:
A-Walrus 2022-07-30 20:17:01 +03:00 committed by GitHub
parent a8b123fe17
commit 5ca98edfb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -533,16 +533,17 @@ impl Component for Prompt {
.map(|entry| entry.into())
.unwrap_or_else(|| Cow::from(""))
} else {
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());
}
self.line.as_str().into()
};
(self.callback_fn)(cx, &input, PromptEvent::Validate);
return close_fn;
}
}