diff options
author | Leoi Hung Kin | 2022-05-22 01:24:32 +0000 |
---|---|---|
committer | GitHub | 2022-05-22 01:24:32 +0000 |
commit | 5c864922d88a88898ab7525f8ebd33f8f5096c59 (patch) | |
tree | 317cac0e8b11b9448b1bb515f89ae67713fd6dda | |
parent | 8df8ff27c2f95864a426a48839d065b237622bac (diff) |
Fix panic when reloading a shrunk file (#2506)
* fix panic when reloading a shrunk file
* linting
* use scrolloff
-rw-r--r-- | helix-term/src/commands/typed.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 74ab73be..5121eaa1 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -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( |