aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/editor.rs10
-rw-r--r--helix-view/src/view.rs5
2 files changed, 12 insertions, 3 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;
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index 66214691..e90d0eab 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -84,7 +84,10 @@ impl View {
}
pub fn ensure_cursor_in_view(&mut self, doc: &Document) {
- let cursor = doc.selection(self.id).cursor(doc.text().slice(..));
+ let cursor = doc
+ .selection(self.id)
+ .primary()
+ .cursor(doc.text().slice(..));
let pos = coords_at_pos(doc.text().slice(..), cursor);
let line = pos.row;
let col = pos.col;