on master help sign in
mouse operations respect scrolloff (#5255)
df1830ejliaoh
helix-term/src/ui/editor.rs+4−1
@@ -1155,6 +1155,7 @@ impl EditorView {
1155 }
1155 }
1156
1156
1157 editor.focus(view_id);
1157 editor.focus(view_id);
1158+ editor.ensure_cursor_in_view(view_id);
1158
1159
1159 return EventResult::Consumed(None);
1160 return EventResult::Consumed(None);
1160 }
1161 }
@@ -1191,7 +1192,8 @@ impl EditorView {
1191 let primary = selection.primary_mut();
1192 let primary = selection.primary_mut();
1192 *primary = primary.put_cursor(doc.text().slice(..), pos, true);
1193 *primary = primary.put_cursor(doc.text().slice(..), pos, true);
1193 doc.set_selection(view.id, selection);
1194 doc.set_selection(view.id, selection);
1194−
1195+ let view_id = view.id;
1196+ cxt.editor.ensure_cursor_in_view(view_id);
1195 EventResult::Consumed(None)
1197 EventResult::Consumed(None)
1196 }
1198 }
1197
1199
@@ -1213,6 +1215,7 @@ impl EditorView {
1213 commands::scroll(cxt, offset, direction);
1215 commands::scroll(cxt, offset, direction);
1214
1216
1215 cxt.editor.tree.focus = current_view;
1217 cxt.editor.tree.focus = current_view;
1218+ cxt.editor.ensure_cursor_in_view(current_view);
1216
1219
1217 EventResult::Consumed(None)
1220 EventResult::Consumed(None)
1218 }
1221 }