Fix panic when reloading a shrunk file (#2506)

* fix panic when reloading a shrunk file

* linting

* use scrolloff
imgbot
Leoi Hung Kin 3 years ago committed by GitHub
parent 8df8ff27c2
commit 5c864922d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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(

Loading…
Cancel
Save