Skip to content

Commit 9a19df7

Browse files
committed
chore: improve slice logic to handle edge cases
1 parent b079d1c commit 9a19df7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/fs_service.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,8 @@ impl FileSystemService {
525525
.into());
526526
}
527527

528-
for i in 0..=content_lines.len() - old_lines.len() {
528+
let max_start = content_lines.len().saturating_sub(old_lines.len());
529+
for i in 0..=max_start {
529530
let potential_match = &content_lines[i..i + old_lines.len()];
530531

531532
// Compare lines with normalized whitespace

0 commit comments

Comments
 (0)