mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 17:36:19 +04:00
Fix panic when reloading a shrunk file (#2506)
* fix panic when reloading a shrunk file * linting * use scrolloff
This commit is contained in:
parent
8df8ff27c2
commit
5c864922d8
@ -781,8 +781,11 @@ fn reload(
|
|||||||
_args: &[Cow<str>],
|
_args: &[Cow<str>],
|
||||||
_event: PromptEvent,
|
_event: PromptEvent,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
|
let scrolloff = cx.editor.config().scrolloff;
|
||||||
let (view, doc) = current!(cx.editor);
|
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(
|
fn tree_sitter_scopes(
|
||||||
|
Loading…
Reference in New Issue
Block a user