Skip to content

Commit

Permalink
Fix panic when reloading a shrunk file (#2506)
Browse files Browse the repository at this point in the history
* fix panic when reloading a shrunk file

* linting

* use scrolloff
  • Loading branch information
pppKin authored May 22, 2022
1 parent 8df8ff2 commit 5c86492
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,11 @@ fn reload(
_args: &[Cow<str>],
_event: PromptEvent,
) -> anyhow::Result<()> {
let scrolloff = cx.editor.config().scrolloff;
let (view, doc) = current!(cx.editor);
doc.reload(view.id)
doc.reload(view.id).map(|_| {
view.ensure_cursor_in_view(doc, scrolloff);
})
}

fn tree_sitter_scopes(
Expand Down

0 comments on commit 5c86492

Please sign in to comment.