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
This commit is contained in:
Johannes Altmanninger
2025-03-10 22:24:29 +01:00
parent ea6e819a33
commit 2b4f150883

View File

@@ -2936,7 +2936,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));
}