aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorLeoi Hung Kin2022-05-22 01:24:32 +0000
committerGitHub2022-05-22 01:24:32 +0000
commit5c864922d88a88898ab7525f8ebd33f8f5096c59 (patch)
tree317cac0e8b11b9448b1bb515f89ae67713fd6dda /helix-term/src
parent8df8ff27c2f95864a426a48839d065b237622bac (diff)
Fix panic when reloading a shrunk file (#2506)
* fix panic when reloading a shrunk file * linting * use scrolloff
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands/typed.rs5
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(