@@ -219,7 +219,7 @@ impl Tree {
220 if self.focus == index {
220 if self.focus == index {
221 // focus on something else
221 // focus on something else
222− self.focus_next();
222+ self.focus = self.next();
225 stack.push(index);
225 stack.push(index);
@@ -521,7 +521,7 @@ impl Tree {
521 Some(child_id)
521 Some(child_id)
524− pub fn focus_next(&mut self) {
524+ pub fn next(&self) -> ViewId {
525 // This function is very dumb, but that's because we don't store any parent links.
525 // This function is very dumb, but that's because we don't store any parent links.
526 // (we'd be able to go parent.next_sibling() recursively until we find something)
526 // (we'd be able to go parent.next_sibling() recursively until we find something)
527 // For now that's okay though, since it's unlikely you'll be able to open a large enough
527 // For now that's okay though, since it's unlikely you'll be able to open a large enough
@@ -532,11 +532,11 @@ impl Tree {
532 .skip_while(|&(id, _view)| id != self.focus)
532 .skip_while(|&(id, _view)| id != self.focus)
533 .skip(1); // Skip focused value
533 .skip(1); // Skip focused value
534 if let Some((id, _)) = views.next() {
534 if let Some((id, _)) = views.next() {
535− self.focus = id;
535+ id
537 // extremely crude, take the first item again
537 // extremely crude, take the first item again
538 let (key, _) = self.traverse().next().unwrap();
538 let (key, _) = self.traverse().next().unwrap();
539− self.focus = key;
539+ key