Fix regression causing crash on empty paste in Vi-mode

Fixes d51f669647 (Vi mode: avoid placing cursor beyond last character,
2024-02-14).

Closes #11256

(cherry picked from commit 2b4f150883)
This commit is contained in:
Johannes Altmanninger
2025-03-10 22:24:29 +01:00
parent 7a959723ef
commit 5d31be1c3e

View File

@@ -2592,7 +2592,7 @@ fn handle_readline_command(&mut self, c: ReadlineCmd) {
self.data
.insert_string(self.active_edit_line_tag(), &yank_str);
self.rls_mut().yank_len = yank_str.len();
if self.cursor_end_mode == CursorEndMode::Inclusive {
if !yank_str.is_empty() && self.cursor_end_mode == CursorEndMode::Inclusive {
let (_elt, el) = self.active_edit_line();
self.update_buff_pos(self.active_edit_line_tag(), Some(el.position() - 1));
}