Skip to content

Commit 1ddae41

Browse files
archseerthomasskk
authored andcommitted
fix: View needs to retain the original scroll offset on split
1 parent 3c62889 commit 1ddae41

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

helix-term/src/commands.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,12 +4182,16 @@ fn split(cx: &mut Context, action: Action) {
41824182
let (view, doc) = current!(cx.editor);
41834183
let id = doc.id();
41844184
let selection = doc.selection(view.id).clone();
4185+
let offset = view.offset;
41854186

41864187
cx.editor.switch(id, action);
41874188

41884189
// match the selection in the previous view
41894190
let (view, doc) = current!(cx.editor);
41904191
doc.set_selection(view.id, selection);
4192+
// match the view scroll offset (switch doesn't handle this fully
4193+
// since the selection is only matched after the split)
4194+
view.offset = offset;
41914195
}
41924196

41934197
fn hsplit(cx: &mut Context) {

0 commit comments

Comments
 (0)