🎨 excerpt_list::Chunks::next
This commit is contained in:
parent
416033a01c
commit
09c0c3a0e7
1 changed files with 43 additions and 44 deletions
|
@ -356,6 +356,7 @@ impl<'a> Iterator for Chunks<'a> {
|
|||
type Item = Chunk<'a>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
loop {
|
||||
if self.header_height > 0 {
|
||||
let chunk = Chunk {
|
||||
text: unsafe {
|
||||
|
@ -370,19 +371,18 @@ impl<'a> Iterator for Chunks<'a> {
|
|||
if let Some(entry_chunks) = self.entry_chunks.as_mut() {
|
||||
if let Some(chunk) = entry_chunks.next() {
|
||||
return Some(chunk);
|
||||
} else if self.range.end >= self.cursor.end(&()) {
|
||||
}
|
||||
self.entry_chunks.take();
|
||||
if self.cursor.end(&()) <= self.range.end {
|
||||
return Some(Chunk {
|
||||
text: "\n",
|
||||
..Default::default()
|
||||
});
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
self.cursor.next(&());
|
||||
if *self.cursor.start() == self.range.end {
|
||||
if *self.cursor.start() >= self.range.end {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
@ -402,8 +402,7 @@ impl<'a> Iterator for Chunks<'a> {
|
|||
.buffer
|
||||
.chunks(buffer_range.start..buffer_end, self.theme),
|
||||
);
|
||||
|
||||
self.next()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue