mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
drop option wrap
This commit is contained in:
parent
8cf8d2b298
commit
89ca34f735
1 changed files with 15 additions and 21 deletions
|
|
@ -17,7 +17,7 @@ pub struct Navigation {
|
||||||
pub back: Back,
|
pub back: Back,
|
||||||
pub forward: Forward,
|
pub forward: Forward,
|
||||||
pub g_box: Box,
|
pub g_box: Box,
|
||||||
iter: RefCell<Option<Cycle<IntoIter<(TextIter, TextIter)>>>>,
|
iter: RefCell<Cycle<IntoIter<(TextIter, TextIter)>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Navigation {
|
impl Navigation {
|
||||||
|
|
@ -45,7 +45,7 @@ impl Navigation {
|
||||||
back,
|
back,
|
||||||
forward,
|
forward,
|
||||||
g_box,
|
g_box,
|
||||||
iter: RefCell::new(None),
|
iter: RefCell::new(Vec::new().into_iter().cycle()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ impl Navigation {
|
||||||
pub fn update(&self, matches: Vec<(TextIter, TextIter)>) {
|
pub fn update(&self, matches: Vec<(TextIter, TextIter)>) {
|
||||||
self.back.update(!matches.is_empty());
|
self.back.update(!matches.is_empty());
|
||||||
self.forward.update(!matches.is_empty());
|
self.forward.update(!matches.is_empty());
|
||||||
self.iter.replace(Some(matches.into_iter().cycle()));
|
let _ = self.iter.replace(matches.into_iter().cycle());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn back(&self, subject: &Subject) -> Option<(TextIter, TextIter)> {
|
pub fn back(&self, subject: &Subject) -> Option<(TextIter, TextIter)> {
|
||||||
|
|
@ -66,15 +66,12 @@ impl Navigation {
|
||||||
&buffer.end_iter(),
|
&buffer.end_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
match self.iter.borrow_mut().as_mut() {
|
match self.iter.borrow_mut().next() {
|
||||||
Some(iter) => match iter.next() {
|
Some((start, end)) => {
|
||||||
Some((start, end)) => {
|
buffer.apply_tag(&subject.tag.current, &start, &end);
|
||||||
buffer.apply_tag(&subject.tag.current, &start, &end);
|
Some((start, end))
|
||||||
Some((start, end))
|
}
|
||||||
}
|
None => None,
|
||||||
None => None,
|
|
||||||
},
|
|
||||||
None => todo!(), // unexpected
|
|
||||||
} // @TODO reverse
|
} // @TODO reverse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,15 +84,12 @@ impl Navigation {
|
||||||
&buffer.end_iter(),
|
&buffer.end_iter(),
|
||||||
);
|
);
|
||||||
|
|
||||||
match self.iter.borrow_mut().as_mut() {
|
match self.iter.borrow_mut().next() {
|
||||||
Some(iter) => match iter.next() {
|
Some((start, end)) => {
|
||||||
Some((start, end)) => {
|
buffer.apply_tag(&subject.tag.current, &start, &end);
|
||||||
buffer.apply_tag(&subject.tag.current, &start, &end);
|
Some((start, end))
|
||||||
Some((start, end))
|
}
|
||||||
}
|
None => None,
|
||||||
None => None,
|
|
||||||
},
|
|
||||||
None => todo!(), // unexpected
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue