Skip to content

Commit 1acdfaa

Browse files
committed
fix: View needs to retain the original scroll offset on split
1 parent 9c3c6a1 commit 1acdfaa

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
@@ -4142,12 +4142,16 @@ fn split(cx: &mut Context, action: Action) {
41424142
let (view, doc) = current!(cx.editor);
41434143
let id = doc.id();
41444144
let selection = doc.selection(view.id).clone();
4145+
let offset = view.offset;
41454146

41464147
cx.editor.switch(id, action);
41474148

41484149
// match the selection in the previous view
41494150
let (view, doc) = current!(cx.editor);
41504151
doc.set_selection(view.id, selection);
4152+
// match the view scroll offset (switch doesn't handle this fully
4153+
// since the selection is only matched after the split)
4154+
view.offset = offset;
41514155
}
41524156

41534157
fn hsplit(cx: &mut Context) {

0 commit comments

Comments
 (0)