mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-29 19:14:13 +00:00
editor: Un-pub ScrollManager (#55767)
Make this only pub(crate) in preparation for https://github.com/zed-industries/zed/pull/44827 Release Notes: - N/A
This commit is contained in:
parent
360f955c28
commit
a2cd962a1a
5 changed files with 18 additions and 9 deletions
|
|
@ -449,7 +449,7 @@ fn create_editor_diff(
|
|||
editor.set_show_vertical_scrollbar(false, cx);
|
||||
editor.set_minimap_visibility(MinimapVisibility::Disabled, window, cx);
|
||||
editor.set_soft_wrap_mode(SoftWrap::None, cx);
|
||||
editor.scroll_manager.set_forbid_vertical_scroll(true);
|
||||
editor.set_forbid_vertical_scroll(true);
|
||||
editor.set_show_indent_guides(false, cx);
|
||||
editor.set_read_only(true);
|
||||
editor.set_delegate_open_excerpts(true);
|
||||
|
|
|
|||
|
|
@ -1425,7 +1425,7 @@ impl InlineAssistant {
|
|||
editor.set_show_gutter(false, cx);
|
||||
editor.set_offset_content(false, cx);
|
||||
editor.disable_mouse_wheel_zoom();
|
||||
editor.scroll_manager.set_forbid_vertical_scroll(true);
|
||||
editor.set_forbid_vertical_scroll(true);
|
||||
editor.set_read_only(true);
|
||||
editor.set_show_edit_predictions(Some(false), window, cx);
|
||||
editor.highlight_rows::<DeletedLines>(
|
||||
|
|
|
|||
|
|
@ -1157,7 +1157,12 @@ pub struct Editor {
|
|||
pub display_map: Entity<DisplayMap>,
|
||||
placeholder_display_map: Option<Entity<DisplayMap>>,
|
||||
pub selections: SelectionsCollection,
|
||||
pub scroll_manager: ScrollManager,
|
||||
/// Manages the scroll position for the given editor.
|
||||
///
|
||||
/// Whenever you want to modify the scroll position of the editor, you should
|
||||
/// usually use the existing available APIs as opposed to directly interacting
|
||||
/// with the scroll manager.
|
||||
pub(crate) scroll_manager: ScrollManager,
|
||||
/// When inline assist editors are linked, they all render cursors because
|
||||
/// typing enters text into each of them, even the ones that aren't focused.
|
||||
pub(crate) show_cursor_when_unfocused: bool,
|
||||
|
|
|
|||
|
|
@ -623,6 +623,14 @@ impl Editor {
|
|||
self.scroll_manager.has_autoscroll_request()
|
||||
}
|
||||
|
||||
pub fn set_forbid_vertical_scroll(&mut self, forbid: bool) {
|
||||
self.scroll_manager.set_forbid_vertical_scroll(forbid);
|
||||
}
|
||||
|
||||
pub fn scroll_top_display_point(&self, snapshot: &DisplaySnapshot, cx: &App) -> DisplayPoint {
|
||||
self.scroll_manager.scroll_top_display_point(snapshot, cx)
|
||||
}
|
||||
|
||||
pub fn vertical_scroll_margin(&self) -> usize {
|
||||
self.scroll_manager.vertical_scroll_margin as usize
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,9 +109,7 @@ impl Vim {
|
|||
self.update_editor(cx, |vim, editor, cx| {
|
||||
let should_move_cursor = editor.newest_selection_on_screen(cx).is_eq();
|
||||
let display_snapshot = editor.display_map.update(cx, |map, cx| map.snapshot(cx));
|
||||
let old_top = editor
|
||||
.scroll_manager
|
||||
.scroll_top_display_point(&display_snapshot, cx);
|
||||
let old_top = editor.scroll_top_display_point(&display_snapshot, cx);
|
||||
|
||||
if editor.scroll_hover(amount, window, cx) {
|
||||
return;
|
||||
|
|
@ -143,9 +141,7 @@ impl Vim {
|
|||
};
|
||||
|
||||
let display_snapshot = editor.display_map.update(cx, |map, cx| map.snapshot(cx));
|
||||
let top = editor
|
||||
.scroll_manager
|
||||
.scroll_top_display_point(&display_snapshot, cx);
|
||||
let top = editor.scroll_top_display_point(&display_snapshot, cx);
|
||||
let vertical_scroll_margin = EditorSettings::get_global(cx).vertical_scroll_margin;
|
||||
|
||||
let mut move_cursor = |map: &editor::display_map::DisplaySnapshot,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue