From 8f4ff4c646988c377218c08c851297e68e860c65 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Tue, 2 Mar 2021 15:44:09 +0900 Subject: editor: We still want to be able to calculate cursor pos. --- helix-term/src/commands.rs | 6 ++---- helix-term/src/ui/editor.rs | 9 +-------- 2 files changed, 3 insertions(+), 12 deletions(-) (limited to 'helix-term/src') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 0d07059f..8c46a1cf 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1119,8 +1119,7 @@ pub fn completion(cx: &mut Context) { cx.callback = Some(Box::new( move |compositor: &mut Compositor, editor: &mut Editor| { - let area = tui::layout::Rect::default(); // TODO: unused remove from cursor_position - if let Some(mut pos) = compositor.cursor_position(area, editor) { + if let Some(mut pos) = editor.cursor_position() { pos.row += 1; // shift down by one row menu.set_position(pos); }; @@ -1181,8 +1180,7 @@ pub fn hover(cx: &mut Context) { cx.callback = Some(Box::new( move |compositor: &mut Compositor, editor: &mut Editor| { - let area = tui::layout::Rect::default(); // TODO: unused remove from cursor_position - if let Some(mut pos) = compositor.cursor_position(area, editor) { + if let Some(mut pos) = editor.cursor_position() { pos.row += 1; // shift down by one row popup.set_position(pos); }; diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 2aa1d469..f1860a27 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -433,14 +433,7 @@ impl Component for EditorView { // Mode::Insert => write!(stdout, "\x1B[6 q"), // mode => write!(stdout, "\x1B[2 q"), // }; - // let view = editor.view(); - // let cursor = view.doc.selection().cursor(); - - // if let Some(mut pos) = view.screen_coords_at_pos(view.doc.text().slice(..), cursor) { - // pos.col += view.area.x as usize + area.x as usize + OFFSET as usize; - // pos.row += view.area.y as usize + area.y as usize; - // return Some(pos); - // } + // return editor.cursor_position() // It's easier to just not render the cursor and use selection rendering instead. None -- cgit v1.2.3-70-g09d2