Skip to content

Commit

Permalink
Fix panic when reloading a shrunk file (helix-editor#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 and mtoohey31 committed Jun 15, 2022
1 parent 50316bc commit 15c5692
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 15c5692

Please sign in to comment.