diff --git a/doc_src/cmds/bind.rst b/doc_src/cmds/bind.rst index 927ecffc2..77dbf5cf1 100644 --- a/doc_src/cmds/bind.rst +++ b/doc_src/cmds/bind.rst @@ -215,7 +215,8 @@ The following special input functions are available: make the current word lowercase ``end-of-buffer`` - moves to the end of the buffer, i.e. the end of the first line + moves to the end of the buffer, i.e. the end of the last line; + or if already at the end of the commandline, accept the current autosuggestion. ``end-of-history`` move to the end of the history diff --git a/src/reader/reader.rs b/src/reader/reader.rs index 72bca5bd4..8e24ce2b6 100644 --- a/src/reader/reader.rs +++ b/src/reader/reader.rs @@ -2859,8 +2859,14 @@ fn handle_readline_command(&mut self, c: ReadlineCmd) { .update_buff_pos(EditableLineTag::Commandline, Some(0)); } rl::EndOfBuffer => { - self.data - .update_buff_pos(EditableLineTag::Commandline, Some(self.command_line_len())); + if self.is_at_autosuggestion() { + self.accept_autosuggestion(AutosuggestionPortion::Count(usize::MAX)); + } else { + self.data.update_buff_pos( + EditableLineTag::Commandline, + Some(self.command_line_len()), + ); + } } rl::CancelCommandline | rl::ClearCommandline => { if self.conf.exit_on_interrupt {