diff --git a/src/keymap.rs b/src/keymap.rs index e158bb518d939457e31fa9cd806918bd51b53cca..71410660de4d0e4c4488141bba40e36b24fda75a 100644 --- a/src/keymap.rs +++ b/src/keymap.rs @@ -255,6 +255,7 @@ impl EditState { } let (n, positive) = self.emacs_num_args(); // consume them in all cases if let Some(cmd) = self.custom_bindings.borrow().get(&key) { + debug!(target: "rustyline", "Custom command: {:?}", cmd); return Ok(if cmd.is_repeatable() { cmd.redo(Some(n)) } else { @@ -371,6 +372,7 @@ impl EditState { let no_num_args = self.num_args == 0; let n = self.vi_num_args(); // consume them in all cases if let Some(cmd) = self.custom_bindings.borrow().get(&key) { + debug!(target: "rustyline", "Custom command: {:?}", cmd); return Ok(if cmd.is_repeatable() { if no_num_args { cmd.redo(None) @@ -526,6 +528,7 @@ impl EditState { fn vi_insert<R: RawReader>(&mut self, rdr: &mut R) -> Result<Cmd> { let key = try!(rdr.next_key()); if let Some(cmd) = self.custom_bindings.borrow().get(&key) { + debug!(target: "rustyline", "Custom command: {:?}", cmd); return Ok(if cmd.is_repeatable() { cmd.redo(None) } else { diff --git a/src/lib.rs b/src/lib.rs index 19c0baba93f2b78490f294e14da8cb4d7316a25c..db9176dad1144fd589574ad0fff642b8e3b4a5c3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -564,17 +564,12 @@ fn edit_history_next(s: &mut State, history: &History, prev: bool) -> Result<()> fn edit_history_search(s: &mut State, history: &History, dir: Direction) -> Result<()> { if history.is_empty() { - return Ok(()); + return beep(); } - if s.history_index == history.len() { - if dir == Direction::Reverse { - // Save the current edited line before to overwrite it - s.snapshot(); - } else { - return Ok(()); - } + if s.history_index == history.len() && dir == Direction::Forward { + return beep(); } else if s.history_index == 0 && dir == Direction::Reverse { - return Ok(()); + return beep(); } if dir == Direction::Reverse { s.history_index -= 1; @@ -588,7 +583,7 @@ fn edit_history_search(s: &mut State, history: &History, dir: Direction) -> Resu s.line.update(buf, buf.len()); s.refresh_line() } else { - Ok(()) + beep() } }