Don't seek FilterCursor upon creation

This lets us use `next` or `prev` to decide whether to park the cursor
at the first or last filtered item.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-03-15 14:57:30 +01:00
parent f10fd6c419
commit a6d0caf557
5 changed files with 58 additions and 50 deletions

View file

@ -1849,10 +1849,11 @@ impl BufferSnapshot {
let fragments_cursor = if *since == self.version {
None
} else {
Some(self.fragments.filter(
move |summary| !since.observed_all(&summary.max_version),
&None,
))
let mut cursor = self
.fragments
.filter(move |summary| !since.observed_all(&summary.max_version));
cursor.next(&None);
Some(cursor)
};
let mut cursor = self
.fragments