Fitzery with cursor
This commit is contained in:
parent
b43153a99f
commit
4e2907e296
2 changed files with 23 additions and 16 deletions
|
@ -322,7 +322,10 @@ where
|
|||
if entry.index < child_summaries.len() {
|
||||
let index = child_summaries[entry.index..]
|
||||
.partition_point(|item| filter_node(item).is_lt());
|
||||
entry.index += index;
|
||||
if index < child_summaries.len() - entry.index {
|
||||
entry.index += index;
|
||||
}
|
||||
|
||||
let position = Some(entry.index)
|
||||
.filter(|index| *index < child_summaries.len())
|
||||
.unwrap_or(child_summaries.len());
|
||||
|
@ -332,10 +335,12 @@ where
|
|||
self.position.add_summary(summary, self.cx);
|
||||
}
|
||||
}
|
||||
dbg!((entry.index, child_trees.len()));
|
||||
|
||||
child_trees.get(entry.index)
|
||||
}
|
||||
Node::Leaf { item_summaries, .. } => {
|
||||
dbg!("Ayo");
|
||||
if !descend {
|
||||
let item_summary = &item_summaries[entry.index];
|
||||
entry.index += 1;
|
||||
|
@ -343,22 +348,24 @@ where
|
|||
self.position.add_summary(item_summary, self.cx);
|
||||
}
|
||||
|
||||
loop {
|
||||
if entry.index < item_summaries.len() {
|
||||
let index = item_summaries[entry.index..]
|
||||
.partition_point(|item| filter_node(item).is_lt());
|
||||
if entry.index < item_summaries.len() {
|
||||
let index = item_summaries[entry.index..]
|
||||
.partition_point(|item| filter_node(item).is_lt());
|
||||
if index < item_summaries.len() - entry.index {
|
||||
entry.index += index;
|
||||
let position = Some(entry.index)
|
||||
.filter(|index| *index < item_summaries.len())
|
||||
.unwrap_or(item_summaries.len());
|
||||
|
||||
if let Some(summary) = item_summaries.get(position) {
|
||||
entry.position.add_summary(summary, self.cx);
|
||||
self.position.add_summary(summary, self.cx);
|
||||
}
|
||||
} else {
|
||||
break None;
|
||||
}
|
||||
entry.index += index;
|
||||
let position = Some(entry.index)
|
||||
.filter(|index| *index < item_summaries.len())
|
||||
.unwrap_or(item_summaries.len());
|
||||
|
||||
if let Some(summary) = item_summaries.get(position) {
|
||||
entry.position.add_summary(summary, self.cx);
|
||||
self.position.add_summary(summary, self.cx);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -406,7 +406,7 @@ mod tests {
|
|||
map.insert("baa", 3);
|
||||
map.insert("baaab", 4);
|
||||
map.insert("c", 5);
|
||||
|
||||
dbg!(&map);
|
||||
let result = map
|
||||
.iter_from(&"ba")
|
||||
.take_while(|(key, _)| key.starts_with("ba"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue