diff options
Diffstat (limited to 'helix-view/src')
-rw-r--r-- | helix-view/src/editor.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index cf4dce28..e9f8b5a1 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -85,7 +85,10 @@ impl Editor { let (view, doc) = self.current(); // initialize selection for view - let selection = doc.selections.entry(view.id).or_insert(Selection::point(0)); + let selection = doc + .selections + .entry(view.id) + .or_insert_with(|| Selection::point(0)); // TODO: reuse align_view let pos = selection.cursor(); let line = doc.text().char_to_line(pos); |