This commit is contained in:
Antonio Scandurra 2023-12-18 14:55:59 +01:00
parent 4e544545d1
commit 2330256741
16 changed files with 736 additions and 829 deletions

View file

@ -889,7 +889,7 @@ impl EditorElement {
}
let fold_corner_radius = 0.15 * layout.position_map.line_height;
cx.with_element_id(Some("folds"), |cx| {
cx.with_element_id(Some("folds"), |_, cx| {
let snapshot = &layout.position_map.snapshot;
for fold in snapshot.folds_in_range(layout.visible_anchor_range.clone()) {
let fold_range = fold.range.clone();
@ -938,7 +938,7 @@ impl EditorElement {
fold_bounds.size,
cx,
|fold_element_state, cx| {
if fold_element_state.is_active() {
if fold_element_state.is_active {
cx.theme().colors().ghost_element_active
} else if fold_bounds.contains(&cx.mouse_position()) {
cx.theme().colors().ghost_element_hover
@ -1996,7 +1996,7 @@ impl EditorElement {
.width;
let scroll_width = longest_line_width.max(max_visible_line_width) + overscroll.width;
let (scroll_width, blocks) = cx.with_element_id(Some("editor_blocks"), |cx| {
let (scroll_width, blocks) = cx.with_element_id(Some("editor_blocks"), |_, cx| {
self.layout_blocks(
start_row..end_row,
&snapshot,
@ -2081,7 +2081,7 @@ impl EditorElement {
cx,
);
let mut fold_indicators = cx.with_element_id(Some("gutter_fold_indicators"), |cx| {
let mut fold_indicators = cx.with_element_id(Some("gutter_fold_indicators"), |_, cx| {
editor.render_fold_indicators(
fold_statuses,
&style,
@ -2734,13 +2734,9 @@ enum Invisible {
}
impl Element for EditorElement {
type State = ();
type FrameState = ();
fn layout(
&mut self,
element_state: Option<Self::State>,
cx: &mut gpui::WindowContext,
) -> (gpui::LayoutId, Self::State) {
fn layout(&mut self, cx: &mut gpui::WindowContext) -> (gpui::LayoutId, Self::FrameState) {
self.editor.update(cx, |editor, cx| {
editor.set_style(self.style.clone(), cx);
@ -2788,7 +2784,7 @@ impl Element for EditorElement {
fn paint(
&mut self,
bounds: Bounds<gpui::Pixels>,
element_state: &mut Self::State,
_element_state: &mut Self::FrameState,
cx: &mut gpui::WindowContext,
) {
let editor = self.editor.clone();
@ -2823,7 +2819,7 @@ impl Element for EditorElement {
self.paint_mouse_listeners(bounds, gutter_bounds, text_bounds, &layout, cx);
if !layout.blocks.is_empty() {
cx.with_element_id(Some("editor_blocks"), |cx| {
cx.with_element_id(Some("editor_blocks"), |_, cx| {
self.paint_blocks(bounds, &mut layout, cx);
});
}