@@ -4142,12 +4142,16 @@ fn split(cx: &mut Context, action: Action) {
4142 let (view, doc) = current!(cx.editor);
4142 let (view, doc) = current!(cx.editor);
4143 let id = doc.id();
4143 let id = doc.id();
4144 let selection = doc.selection(view.id).clone();
4144 let selection = doc.selection(view.id).clone();
4145+ let offset = view.offset;
4146 cx.editor.switch(id, action);
4147 cx.editor.switch(id, action);
4148 // match the selection in the previous view
4149 // match the selection in the previous view
4149 let (view, doc) = current!(cx.editor);
4150 let (view, doc) = current!(cx.editor);
4150 doc.set_selection(view.id, selection);
4151 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;
4153fn hsplit(cx: &mut Context) {
4157fn hsplit(cx: &mut Context) {