Use options to represent soft-wrapped buffer rows

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-11-17 19:30:40 +01:00
co-authored by Nathan Sobo Max Brunsfeld
parent d9283efbe6
commit 198f6694b7
2 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -702,7 +702,7 @@ impl Snapshot {
prev_tab_row = tab_point.row();
soft_wrapped = false;
}
expected_buffer_rows.push((buffer_row, soft_wrapped));
expected_buffer_rows.push(if soft_wrapped { None } else { Some(buffer_row) });
}
for start_display_row in 0..expected_buffer_rows.len() {
@@ -782,7 +782,7 @@ impl<'a> Iterator for Chunks<'a> {
}
impl<'a> Iterator for BufferRows<'a> {
type Item = (u32, bool);
type Item = Option<u32>;
fn next(&mut self) -> Option<Self::Item> {
if self.output_row > self.max_output_row {
@@ -802,7 +802,7 @@ impl<'a> Iterator for BufferRows<'a> {
self.soft_wrapped = true;
}
Some((buffer_row, soft_wrapped))
Some(if soft_wrapped { None } else { Some(buffer_row) })
}
}