@@ -533,18 +533,24 @@ impl Component for Prompt {
533 if self.selection.is_some() && self.line.ends_with(std::path::MAIN_SEPARATOR) {
533 if self.selection.is_some() && self.line.ends_with(std::path::MAIN_SEPARATOR) {
534 self.recalculate_completion(cx.editor);
534 self.recalculate_completion(cx.editor);
536+ let last_item = self
538+ .and_then(|reg| cx.editor.registers.last(reg).cloned())
539+ .map(|entry| entry.into())
540+ .unwrap_or_else(|| Cow::from(""));
536 // handle executing with last command in history if nothing entered
542 // handle executing with last command in history if nothing entered
537 let input: Cow<str> = if self.line.is_empty() {
543 let input: Cow<str> = if self.line.is_empty() {
538− // latest value in the register list
544+ last_item
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− if let Some(register) = self.history_register {
546+ if last_item != self.line {
545 // store in history
547 // store in history
548+ if let Some(register) = self.history_register {
546− let register = cx.editor.registers.get_mut(register);
551+ .get_mut(register)
547− register.push(self.line.clone());
552+ .push(self.line.clone());
550 self.line.as_str().into()
556 self.line.as_str().into()