diff options
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r-- | helix-view/src/editor.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 1cd0af02..d5a76c11 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -145,7 +145,10 @@ impl Editor { .entry(view.id) .or_insert_with(|| Selection::point(0)); // TODO: reuse align_view - let pos = doc.selection(view.id).cursor(doc.text().slice(..)); + let pos = doc + .selection(view.id) + .primary() + .cursor(doc.text().slice(..)); let line = doc.text().char_to_line(pos); view.first_line = line.saturating_sub(view.area.height as usize / 2); @@ -295,7 +298,10 @@ impl Editor { const OFFSET: u16 = 7; // 1 diagnostic + 5 linenr + 1 gutter let view = view!(self); let doc = &self.documents[view.doc]; - let cursor = doc.selection(view.id).cursor(doc.text().slice(..)); + let cursor = doc + .selection(view.id) + .primary() + .cursor(doc.text().slice(..)); if let Some(mut pos) = view.screen_coords_at_pos(doc, doc.text().slice(..), cursor) { pos.col += view.area.x as usize + OFFSET as usize; pos.row += view.area.y as usize; |