diff --git a/src/reader.rs b/src/reader.rs index 019c5beb0..173498e80 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -2043,21 +2043,27 @@ impl ReaderData { self.update_buff_pos(elt, Some(position - 1)); } } - rl::EndOfLine => loop { - let position = { - let (_elt, el) = self.active_edit_line(); - let position = el.position(); - if position == el.len() { - self.accept_autosuggestion(true, false, MoveWordStyle::Punctuation); - break; + rl::EndOfLine => { + let (_elt, el) = self.active_edit_line(); + if el.position() == el.len() { + self.accept_autosuggestion(true, false, MoveWordStyle::Punctuation); + } else { + loop { + 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 => { self.update_buff_pos(EditableLineTag::Commandline, Some(0)); } diff --git a/tests/checks/tmux-complete.fish b/tests/checks/tmux-complete.fish index ed22c12fc..a9195f21e 100644 --- a/tests/checks/tmux-complete.fish +++ b/tests/checks/tmux-complete.fish @@ -94,3 +94,11 @@ isolated-tmux send-keys C-s tmux-sleep isolated-tmux capture-pane -p # 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