Fix regression of C-e always accepting autosuggestion

This commit is contained in:
Johannes Altmanninger 2024-02-17 01:27:43 +01:00
parent 8c91d1421a
commit b687ef036b
2 changed files with 28 additions and 14 deletions

View file

@ -2043,21 +2043,27 @@ impl ReaderData {
self.update_buff_pos(elt, Some(position - 1)); self.update_buff_pos(elt, Some(position - 1));
} }
} }
rl::EndOfLine => loop { rl::EndOfLine => {
let position = { let (_elt, el) = self.active_edit_line();
let (_elt, el) = self.active_edit_line(); if el.position() == el.len() {
let position = el.position(); self.accept_autosuggestion(true, false, MoveWordStyle::Punctuation);
if position == el.len() { } else {
self.accept_autosuggestion(true, false, MoveWordStyle::Punctuation); loop {
break; let position = {
let (_elt, el) = self.active_edit_line();
let position = el.position();
if position == el.len() {
break;
}
if el.text().char_at(position) == '\n' {
break;
}
position
};
self.update_buff_pos(self.active_edit_line_tag(), Some(position + 1));
} }
if el.text().char_at(position) == '\n' { }
break; }
}
position
};
self.update_buff_pos(self.active_edit_line_tag(), Some(position + 1));
},
rl::BeginningOfBuffer => { rl::BeginningOfBuffer => {
self.update_buff_pos(EditableLineTag::Commandline, Some(0)); self.update_buff_pos(EditableLineTag::Commandline, Some(0));
} }

View file

@ -94,3 +94,11 @@ isolated-tmux send-keys C-s
tmux-sleep tmux-sleep
isolated-tmux capture-pane -p isolated-tmux capture-pane -p
# CHECK: prompt 7> echo suggest this # CHECK: prompt 7> echo suggest this
isolated-tmux send-keys C-u
isolated-tmux send-keys 'echo sugg' C-a
tmux-sleep
isolated-tmux send-keys C-e M-f Space nothing
tmux-sleep
isolated-tmux capture-pane -p
# CHECK: prompt 7> echo suggest nothing