From 5c4a9cba9a14ca10437e979c884d2ccba78ef1e7 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Thu, 15 Dec 2022 14:20:26 +0100 Subject: [PATCH] Restore deleted goto_pos function (#5164) --- helix-term/src/commands.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 0f04ecba6..6cf494646 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2789,6 +2789,14 @@ fn exit_select_mode(cx: &mut Context) { } } +fn goto_pos(editor: &mut Editor, pos: usize) { + let (view, doc) = current!(editor); + + push_jump(view, doc); + doc.set_selection(view.id, Selection::point(pos)); + align_view(doc, view, Align::Center); +} + fn goto_first_diag(cx: &mut Context) { let (view, doc) = current!(cx.editor); let selection = match doc.diagnostics().first() {