diff --git a/src/command.rs b/src/command.rs index f434b79db..89a0b9bd3 100644 --- a/src/command.rs +++ b/src/command.rs @@ -222,7 +222,7 @@ pub fn execute( // Move to end, in case cursor was in the middle of the // line, so that next thing application prints goes after // the input - s.edit_move_buffer_end()?; + s.move_cursor_to_end()?; return Err(error::ReadlineError::Interrupted); } _ => { diff --git a/src/edit.rs b/src/edit.rs index 5e4718828..a77018d50 100644 --- a/src/edit.rs +++ b/src/edit.rs @@ -130,6 +130,15 @@ impl<'out, 'prompt, H: Helper> State<'out, 'prompt, H> { Ok(()) } + pub fn move_cursor_to_end(&mut self) -> Result<()> { + if self.layout.cursor == self.layout.end { + return Ok(()); + } + self.out.move_cursor(self.layout.cursor, self.layout.end)?; + self.layout.cursor = self.layout.end; + Ok(()) + } + pub fn move_cursor_at_leftmost(&mut self, rdr: &mut ::Reader) -> Result<()> { self.out.move_cursor_at_leftmost(rdr) }