Fix condition for re-using highlights when seeking buffer chunks iterator (#19760)

Fixes a syntax highlighting regression introduced in
https://github.com/zed-industries/zed/pull/19531, which caused syntax
highlighting to be missing after any block.

Release Notes:

- N/A
This commit is contained in:
Max Brunsfeld 2024-10-25 12:37:03 -07:00 committed by GitHub
parent 92ba18342c
commit 7d0a7aff44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 102 additions and 5 deletions

View file

@ -4035,7 +4035,7 @@ impl<'a> BufferChunks<'a> {
let old_range = std::mem::replace(&mut self.range, range.clone());
self.chunks.set_range(self.range.clone());
if let Some(highlights) = self.highlights.as_mut() {
if old_range.start >= self.range.start && old_range.end <= self.range.end {
if old_range.start <= self.range.start && old_range.end >= self.range.end {
// Reuse existing highlights stack, as the new range is a subrange of the old one.
highlights
.stack