vim: Fix snapshot out of bounds indexing (#42969)

Fixes ZED-38X

Release Notes:

- N/A
This commit is contained in:
Lukas Wirth
2025-11-18 13:02:40 +00:00
committed by GitHub
parent f17d2c92b6
commit d2988ffc77
+1 -1
View File
@@ -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 boundaries
if offset == 0 || ch.is_whitespace() || (need_range && offset <= start_offset) {
break;