diff options
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r-- | helix-term/src/commands.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 07e71a70..855a12eb 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1072,9 +1072,10 @@ 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 - let mut pos = compositor.cursor_position(area, editor); - pos.row += 1; // shift down by one row - menu.set_position(pos); + if let Some(mut pos) = compositor.cursor_position(area, editor) { + pos.row += 1; // shift down by one row + menu.set_position(pos); + }; compositor.push(Box::new(menu)); }, @@ -1133,9 +1134,10 @@ 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 - let mut pos = compositor.cursor_position(area, editor); - pos.row += 1; // shift down by one row - popup.set_position(pos); + if let Some(mut pos) = compositor.cursor_position(area, editor) { + pos.row += 1; // shift down by one row + popup.set_position(pos); + }; compositor.push(Box::new(popup)); }, |