end-of-buffer: accept autosuggestion if already at ned

This commit is contained in:
Johannes Altmanninger
2026-01-09 07:21:11 +01:00
parent 7a05ea0f93
commit 917fb024ea
2 changed files with 10 additions and 3 deletions

View File

@@ -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

View File

@@ -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 {