mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 22:13:58 -05:00
modify collect_ranges to take param on whether to join ranges
This commit is contained in:
parent
d3d6bd8ce0
commit
b9eeb891df
1 changed files with 3 additions and 3 deletions
|
|
@ -899,7 +899,7 @@ impl RequiredTable {
|
|||
/// contiguous numbers.
|
||||
trait CollectRanges {
|
||||
type Item;
|
||||
fn collect_ranges(self) -> Vec<Range<Self::Item>>;
|
||||
fn collect_ranges(self, join: bool) -> Vec<Range<Self::Item>>;
|
||||
}
|
||||
|
||||
impl<
|
||||
|
|
@ -909,7 +909,7 @@ impl<
|
|||
{
|
||||
type Item = Idx;
|
||||
|
||||
fn collect_ranges(self) -> Vec<Range<Self::Item>> {
|
||||
fn collect_ranges(self, join: bool) -> Vec<Range<Self::Item>> {
|
||||
let mut result = Vec::new();
|
||||
let mut iter = self.into_iter();
|
||||
let next = iter.next();
|
||||
|
|
@ -920,7 +920,7 @@ impl<
|
|||
let mut end = next.unwrap();
|
||||
|
||||
for i in iter {
|
||||
if i == end + 1.into() {
|
||||
if join && i == end + 1.into() {
|
||||
end = end + 1.into();
|
||||
} else {
|
||||
result.push(start..end + 1.into());
|
||||
|
|
|
|||
Loading…
Reference in a new issue