From adb765851795f900d87efe4c893f510b52492550 Mon Sep 17 00:00:00 2001 From: Sam Vente Date: Mon, 16 Sep 2024 10:56:53 +0200 Subject: [PATCH] ensure cursor in view after goto mark --- helix-term/src/commands/typed.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index e4dafb1db..41404e2d8 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -581,6 +581,7 @@ fn goto_mark( ) .unwrap_or('^'); + let scrolloff = cx.editor.config().scrolloff; // use some helper functions to avoid making the borrow checker angry let registers_vals = read_from_register(cx.editor, register_name); let (doc_id, history_rev, mut selection) = parse_mark_register_contents(registers_vals)?; @@ -598,6 +599,9 @@ fn goto_mark( }; doc.set_selection(view.id, selection); + + view.ensure_cursor_in_view(doc, scrolloff); + Ok(()) }