summaryrefslogtreecommitdiff
path: root/helix-view/src/tree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/tree.rs')
-rw-r--r--helix-view/src/tree.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/helix-view/src/tree.rs b/helix-view/src/tree.rs
index 0a487b6f..e56566e3 100644
--- a/helix-view/src/tree.rs
+++ b/helix-view/src/tree.rs
@@ -164,7 +164,18 @@ impl Tree {
self.recalculate()
}
- pub fn views(&mut self) -> impl Iterator<Item = (&mut View, bool)> {
+ pub fn views(&self) -> impl Iterator<Item = (&View, bool)> {
+ let focus = self.focus;
+ self.nodes.iter().filter_map(move |(key, node)| match node {
+ Node {
+ content: Content::View(view),
+ ..
+ } => Some((view.as_ref(), focus == key)),
+ _ => None,
+ })
+ }
+
+ pub fn views_mut(&mut self) -> impl Iterator<Item = (&mut View, bool)> {
let focus = self.focus;
self.nodes
.iter_mut()
@@ -231,7 +242,6 @@ impl Tree {
Content::View(view) => {
// debug!!("setting view area {:?}", area);
view.area = area;
- view.ensure_cursor_in_view();
} // TODO: call f()
Content::Container(container) => {
// debug!!("setting container area {:?}", area);