@@ -219,7 +219,7 @@ impl Tree {
219219
220220 if self.focus == index {
221221 // focus on something else
222− self.focus_next();
222+ self.focus = self.next();
223223 }
224224
225225 stack.push(index);
@@ -521,7 +521,7 @@ impl Tree {
521521 Some(child_id)
522522 }
523523
524− pub fn focus_next(&mut self) {
524+ pub fn next(&self) -> ViewId {
525525 // This function is very dumb, but that's because we don't store any parent links.
526526 // (we'd be able to go parent.next_sibling() recursively until we find something)
527527 // 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 {
532532 .skip_while(|&(id, _view)| id != self.focus)
533533 .skip(1); // Skip focused value
534534 if let Some((id, _)) = views.next() {
535− self.focus = id;
535+ id
536536 } else {
537537 // extremely crude, take the first item again
538538 let (key, _) = self.traverse().next().unwrap();
539− self.focus = key;
539+ key
540540 }
541541 }
542542