React on multibuffer scrolls again

This commit is contained in:
Kirill Bulatov 2023-06-20 01:42:59 +03:00
parent a31d3eca45
commit 2f1a27631e
3 changed files with 59 additions and 23 deletions

View file

@ -13,7 +13,7 @@ use gpui::{
};
use language::{Bias, Point};
use util::ResultExt;
use workspace::WorkspaceId;
use workspace::{item::Item, WorkspaceId};
use crate::{
display_map::{DisplaySnapshot, ToDisplayPoint},
@ -176,7 +176,7 @@ impl ScrollManager {
autoscroll: bool,
workspace_id: Option<i64>,
cx: &mut ViewContext<Editor>,
) {
) -> ScrollAnchor {
let (new_anchor, top_row) = if scroll_position.y() <= 0. {
(
ScrollAnchor {
@ -205,6 +205,7 @@ impl ScrollManager {
};
self.set_anchor(new_anchor, top_row, local, autoscroll, workspace_id, cx);
new_anchor
}
fn set_anchor(
@ -312,7 +313,7 @@ impl Editor {
hide_hover(self, cx);
let workspace_id = self.workspace.as_ref().map(|workspace| workspace.1);
self.scroll_manager.set_scroll_position(
let scroll_anchor = self.scroll_manager.set_scroll_position(
scroll_position,
&map,
local,
@ -320,6 +321,10 @@ impl Editor {
workspace_id,
cx,
);
if !self.is_singleton(cx) {
self.refresh_inlays(crate::InlayRefreshReason::Scroll(scroll_anchor), cx);
}
}
pub fn scroll_position(&self, cx: &mut ViewContext<Self>) -> Vector2F {