Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
vim: Fix snapshot out of bounds indexing (#42969)
Lukas Wirthd2988ffc779e
diff --git a/crates/vim/src/normal/increment.rs b/crates/vim/src/normal/increment.rsindex 888d9ff25b6..7eadf5053a1 100644--- a/crates/vim/src/normal/increment.rs+++ b/crates/vim/src/normal/increment.rs@@ -211,7 +211,7 @@ fn find_target(let mut pre_char = String::new();// Backward scan to find the start of the number, but stop at start_offset- for ch in snapshot.reversed_chars_at(offset + 1) {+ for ch in snapshot.reversed_chars_at(offset + if offset < snapshot.len() { 1 } else { 0 }) {// Search boundariesif offset == 0 || ch.is_whitespace() || (need_range && offset <= start_offset) {break;