@@ -533,18 +533,24 @@ impl Component for Prompt {
533533 if self.selection.is_some() && self.line.ends_with(std::path::MAIN_SEPARATOR) {
534534 self.recalculate_completion(cx.editor);
535535 } else {
536+ let last_item = self
537+ .history_register
538+ .and_then(|reg| cx.editor.registers.last(reg).cloned())
539+ .map(|entry| entry.into())
540+ .unwrap_or_else(|| Cow::from(""));
541+
536542 // handle executing with last command in history if nothing entered
537543 let input: Cow<str> = if self.line.is_empty() {
538− // latest value in the register list
539− self.history_register
540− .and_then(|reg| cx.editor.registers.last(reg).cloned())
541− .map(|entry| entry.into())
542− .unwrap_or_else(|| Cow::from(""))
544+ last_item
543545 } else {
544− if let Some(register) = self.history_register {
546+ if last_item != self.line {
545547 // store in history
546− let register = cx.editor.registers.get_mut(register);
547− register.push(self.line.clone());
548+ if let Some(register) = self.history_register {
549+ cx.editor
550+ .registers
551+ .get_mut(register)
552+ .push(self.line.clone());
553+ };
548554 }
549555
550556 self.line.as_str().into()