Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Merge remote-tracking branch 'origin/main' into editor2-paint
Antonio Scandurrabdf6e8bcc7be
diff --cc crates/editor2/src/display_map.rsindex abf8dcfb95d,2955a929f8e..51f5b0a192b--- a/crates/editor2/src/display_map.rs+++ b/crates/editor2/src/display_map.rs@@@ -501,62 -496,63 +501,62 @@@ impl DisplaySnapshot)}- // pub fn highlighted_chunks<'a>(- // &'a self,- // display_rows: Range<u32>,- // language_aware: bool,- // style: &'a EditorStyle,- // ) -> impl Iterator<Item = HighlightedChunk<'a>> {- // self.chunks(- // display_rows,- // language_aware,- // Some(style.theme.hint),- // Some(style.theme.suggestion),- // )- // .map(|chunk| {- // let mut highlight_style = chunk- // .syntax_highlight_id- // .and_then(|id| id.style(&style.syntax));-- // if let Some(chunk_highlight) = chunk.highlight_style {- // if let Some(highlight_style) = highlight_style.as_mut() {- // highlight_style.highlight(chunk_highlight);- // } else {- // highlight_style = Some(chunk_highlight);- // }- // }-- // let mut diagnostic_highlight = HighlightStyle::default();-- // if chunk.is_unnecessary {- // diagnostic_highlight.fade_out = Some(style.unnecessary_code_fade);- // }-- // if let Some(severity) = chunk.diagnostic_severity {- // // Omit underlines for HINT/INFO diagnostics on 'unnecessary' code.- // if severity <= DiagnosticSeverity::WARNING || !chunk.is_unnecessary {- // todo!()- // // let diagnostic_style = super::diagnostic_style(severity, true, style);- // // diagnostic_highlight.underline = Some(UnderlineStyle {- // // color: Some(diagnostic_style.message.text.color),- // // thickness: 1.0.into(),- // // wavy: true,- // // });- // }- // }-- // if let Some(highlight_style) = highlight_style.as_mut() {- // highlight_style.highlight(diagnostic_highlight);- // } else {- // highlight_style = Some(diagnostic_highlight);- // }-- // HighlightedChunk {- // chunk: chunk.text,- // style: highlight_style,- // is_tab: chunk.is_tab,- // }- // })- // }+ pub fn highlighted_chunks<'a>(+ &'a self,+ display_rows: Range<u32>,+ language_aware: bool,+ theme: &'a ThemeVariant,+ ) -> impl Iterator<Item = HighlightedChunk<'a>> {+ self.chunks(+ display_rows,+ language_aware,- Some(theme.styles.inlay_highlight_style),- Some(theme.styles.suggestion_highlight_style),++ None, // todo!("add inlay highlight style")++ None, // todo!("add suggestion highlight style")+ )+ .map(|chunk| {+ let mut highlight_style = chunk+ .syntax_highlight_id+ .and_then(|id| id.style(&theme.styles.syntax));++ if let Some(chunk_highlight) = chunk.highlight_style {+ if let Some(highlight_style) = highlight_style.as_mut() {+ highlight_style.highlight(chunk_highlight);+ } else {+ highlight_style = Some(chunk_highlight);+ }+ }++ let mut diagnostic_highlight = HighlightStyle::default();++ if chunk.is_unnecessary {+ diagnostic_highlight.fade_out = Some(UNNECESSARY_CODE_FADE);+ }++ if let Some(severity) = chunk.diagnostic_severity {+ // Omit underlines for HINT/INFO diagnostics on 'unnecessary' code.+ if severity <= DiagnosticSeverity::WARNING || !chunk.is_unnecessary {+ let diagnostic_color = super::diagnostic_style(severity, true, theme);+ diagnostic_highlight.underline = Some(UnderlineStyle {+ color: Some(diagnostic_color),+ thickness: 1.0.into(),+ wavy: true,+ });+ }+ }++ if let Some(highlight_style) = highlight_style.as_mut() {+ highlight_style.highlight(diagnostic_highlight);+ } else {+ highlight_style = Some(diagnostic_highlight);+ }++ HighlightedChunk {+ chunk: chunk.text,+ style: highlight_style,+ is_tab: chunk.is_tab,+ }+ })+ }pub fn lay_out_line_for_row(&self,diff --cc crates/editor2/src/editor.rsindex 0790641b496,52628f61b58..88df58c50f7--- a/crates/editor2/src/editor.rs+++ b/crates/editor2/src/editor.rs@@@ -9323,23 -9325,10 +9323,23 @@@ impl Render for Editortype Element = EditorElement;fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {+ let settings = ThemeSettings::get_global(cx);+ let text_style = TextStyle {+ color: cx.theme().colors().text,+ font_family: settings.buffer_font.family.clone(),+ font_features: settings.buffer_font.features,+ font_size: settings.buffer_font_size.into(),+ font_weight: FontWeight::NORMAL,+ font_style: FontStyle::Normal,+ line_height: Default::default(),+ underline: None,+ };EditorElement::new(EditorStyle {- background: cx.theme().colors().editor,- text: cx.text_style(),- line_height_scalar: 1.,- theme_id: 0,++ background: cx.theme().colors().editor_background,+ local_player: cx.theme().players().local(),+ text: text_style,+ line_height_scalar: settings.buffer_line_height.value(),+ scrollbar_width: px(12.),})}}diff --cc crates/editor2/src/element.rsindex e1fea4a8e5b,6420d1e6cd6..b84aedd76a1--- a/crates/editor2/src/element.rs+++ b/crates/editor2/src/element.rs@@@ -498,578 -484,560 +498,578 @@@ impl EditorElement// true// }- // fn paint_background(- // &self,- // gutter_bounds: Bounds<Pixels>,- // text_bounds: Bounds<Pixels>,- // layout: &LayoutState,- // cx: &mut ViewContext<Editor>,- // ) {- // let bounds = gutter_bounds.union_rect(text_bounds);- // let scroll_top =- // layout.position_map.snapshot.scroll_position().y() * layout.position_map.line_height;- // cx.scene().push_quad(Quad {- // bounds: gutter_bounds,- // background: Some(self.style.gutter_background),- // border: Border::new(0., Color::transparent_black()).into(),- // corner_radii: Default::default(),- // });- // cx.scene().push_quad(Quad {- // bounds: text_bounds,- // background: Some(self.style.background),- // border: Border::new(0., Color::transparent_black()).into(),- // corner_radii: Default::default(),- // });-- // if let EditorMode::Full = layout.mode {- // let mut active_rows = layout.active_rows.iter().peekable();- // while let Some((start_row, contains_non_empty_selection)) = active_rows.next() {- // let mut end_row = *start_row;- // while active_rows.peek().map_or(false, |r| {- // *r.0 == end_row + 1 && r.1 == contains_non_empty_selection- // }) {- // active_rows.next().unwrap();- // end_row += 1;- // }-- // if !contains_non_empty_selection {- // let origin = vec2f(- // bounds.origin_x(),- // bounds.origin_y() + (layout.position_map.line_height * *start_row as f32)- // - scroll_top,- // );- // let size = vec2f(- // bounds.width(),- // layout.position_map.line_height * (end_row - start_row + 1) as f32,- // );- // cx.scene().push_quad(Quad {- // bounds: Bounds<Pixels>::new(origin, size),- // background: Some(self.style.active_line_background),- // border: Border::default().into(),- // corner_radii: Default::default(),- // });- // }- // }-- // if let Some(highlighted_rows) = &layout.highlighted_rows {- // let origin = vec2f(- // bounds.origin_x(),- // bounds.origin_y()- // + (layout.position_map.line_height * highlighted_rows.start as f32)- // - scroll_top,- // );- // let size = vec2f(- // bounds.width(),- // layout.position_map.line_height * highlighted_rows.len() as f32,- // );- // cx.scene().push_quad(Quad {- // bounds: Bounds<Pixels>::new(origin, size),- // background: Some(self.style.highlighted_line_background),- // border: Border::default().into(),- // corner_radii: Default::default(),- // });- // }-- // let scroll_left =- // layout.position_map.snapshot.scroll_position().x() * layout.position_map.em_width;-- // for (wrap_position, active) in layout.wrap_guides.iter() {- // let x =- // (text_bounds.origin_x() + wrap_position + layout.position_map.em_width / 2.)- // - scroll_left;-- // if x < text_bounds.origin_x()- // || (layout.show_scrollbars && x > self.scrollbar_left(&bounds))- // {- // continue;- // }-- // let color = if *active {- // self.style.active_wrap_guide- // } else {- // self.style.wrap_guide- // };- // cx.scene().push_quad(Quad {- // bounds: Bounds<Pixels>::new(- // vec2f(x, text_bounds.origin_y()),- // vec2f(1., text_bounds.height()),- // ),- // background: Some(color),- // border: Border::new(0., Color::transparent_black()).into(),- // corner_radii: Default::default(),- // });- // }- // }- // }-- // fn paint_gutter(- // &mut self,- // bounds: Bounds<Pixels>,- // visible_bounds: Bounds<Pixels>,- // layout: &mut LayoutState,- // editor: &mut Editor,- // cx: &mut ViewContext<Editor>,- // ) {- // let line_height = layout.position_map.line_height;-- // let scroll_position = layout.position_map.snapshot.scroll_position();- // let scroll_top = scroll_position.y() * line_height;-- // let show_gutter = matches!(- // settings::get::<ProjectSettings>(cx).git.git_gutter,- // Some(GitGutterSetting::TrackedFiles)- // );-- // if show_gutter {- // Self::paint_diff_hunks(bounds, layout, cx);- // }-- // for (ix, line) in layout.line_number_layouts.iter().enumerate() {- // if let Some(line) = line {- // let line_origin = bounds.origin()- // + vec2f(- // bounds.width() - line.width() - layout.gutter_padding,- // ix as f32 * line_height - (scroll_top % line_height),- // );-- // line.paint(line_origin, visible_bounds, line_height, cx);- // }- // }-- // for (ix, fold_indicator) in layout.fold_indicators.iter_mut().enumerate() {- // if let Some(indicator) = fold_indicator.as_mut() {- // let position = vec2f(- // bounds.width() - layout.gutter_padding,- // ix as f32 * line_height - (scroll_top % line_height),- // );- // let centering_offset = vec2f(- // (layout.gutter_padding + layout.gutter_margin - indicator.size().x()) / 2.,- // (line_height - indicator.size().y()) / 2.,- // );-- // let indicator_origin = bounds.origin() + position + centering_offset;-- // indicator.paint(indicator_origin, visible_bounds, editor, cx);- // }- // }-- // if let Some((row, indicator)) = layout.code_actions_indicator.as_mut() {- // let mut x = 0.;- // let mut y = *row as f32 * line_height - scroll_top;- // x += ((layout.gutter_padding + layout.gutter_margin) - indicator.size().x()) / 2.;- // y += (line_height - indicator.size().y()) / 2.;- // indicator.paint(bounds.origin() + vec2f(x, y), visible_bounds, editor, cx);- // }- // }-- // fn paint_diff_hunks(bounds: Bounds<Pixels>, layout: &mut LayoutState, cx: &mut ViewContext<Editor>) {- // let diff_style = &theme::current(cx).editor.diff.clone();- // let line_height = layout.position_map.line_height;-- // let scroll_position = layout.position_map.snapshot.scroll_position();- // let scroll_top = scroll_position.y() * line_height;-- // for hunk in &layout.display_hunks {- // let (display_row_range, status) = match hunk {- // //TODO: This rendering is entirely a horrible hack- // &DisplayDiffHunk::Folded { display_row: row } => {- // let start_y = row as f32 * line_height - scroll_top;- // let end_y = start_y + line_height;-- // let width = diff_style.removed_width_em * line_height;- // let highlight_origin = bounds.origin() + vec2f(-width, start_y);- // let highlight_size = vec2f(width * 2., end_y - start_y);- // let highlight_bounds = Bounds<Pixels>::new(highlight_origin, highlight_size);-- // cx.scene().push_quad(Quad {- // bounds: highlight_bounds,- // background: Some(diff_style.modified),- // border: Border::new(0., Color::transparent_black()).into(),- // corner_radii: (1. * line_height).into(),- // });-- // continue;- // }-- // DisplayDiffHunk::Unfolded {- // display_row_range,- // status,- // } => (display_row_range, status),- // };-- // let color = match status {- // DiffHunkStatus::Added => diff_style.inserted,- // DiffHunkStatus::Modified => diff_style.modified,-- // //TODO: This rendering is entirely a horrible hack- // DiffHunkStatus::Removed => {- // let row = display_row_range.start;-- // let offset = line_height / 2.;- // let start_y = row as f32 * line_height - offset - scroll_top;- // let end_y = start_y + line_height;-- // let width = diff_style.removed_width_em * line_height;- // let highlight_origin = bounds.origin() + vec2f(-width, start_y);- // let highlight_size = vec2f(width * 2., end_y - start_y);- // let highlight_bounds = Bounds<Pixels>::new(highlight_origin, highlight_size);-- // cx.scene().push_quad(Quad {- // bounds: highlight_bounds,- // background: Some(diff_style.deleted),- // border: Border::new(0., Color::transparent_black()).into(),- // corner_radii: (1. * line_height).into(),- // });-- // continue;- // }- // };-- // let start_row = display_row_range.start;- // let end_row = display_row_range.end;-- // let start_y = start_row as f32 * line_height - scroll_top;- // let end_y = end_row as f32 * line_height - scroll_top;-- // let width = diff_style.width_em * line_height;- // let highlight_origin = bounds.origin() + vec2f(-width, start_y);- // let highlight_size = vec2f(width * 2., end_y - start_y);- // let highlight_bounds = Bounds<Pixels>::new(highlight_origin, highlight_size);-- // cx.scene().push_quad(Quad {- // bounds: highlight_bounds,- // background: Some(color),- // border: Border::new(0., Color::transparent_black()).into(),- // corner_radii: (diff_style.corner_radius * line_height).into(),- // });- // }- // }-- // fn paint_text(- // &mut self,- // bounds: Bounds<Pixels>,- // visible_bounds: Bounds<Pixels>,- // layout: &mut LayoutState,- // editor: &mut Editor,- // cx: &mut ViewContext<Editor>,- // ) {- // let style = &self.style;- // let scroll_position = layout.position_map.snapshot.scroll_position();- // let start_row = layout.visible_display_row_range.start;- // let scroll_top = scroll_position.y() * layout.position_map.line_height;- // let max_glyph_width = layout.position_map.em_width;- // let scroll_left = scroll_position.x() * max_glyph_width;- // let content_origin = bounds.origin() + vec2f(layout.gutter_margin, 0.);- // let line_end_overshoot = 0.15 * layout.position_map.line_height;- // let whitespace_setting = editor.buffer.read(cx).settings_at(0, cx).show_whitespaces;-- // cx.scene().push_layer(Some(bounds));-- // cx.scene().push_cursor_region(CursorRegion {- // bounds,- // style: if !editor.link_go_to_definition_state.definitions.is_empty() {- // CursorStyle::PointingHand- // } else {- // CursorStyle::IBeam- // },- // });+ fn paint_background(+ &self,+ gutter_bounds: Bounds<Pixels>,+ text_bounds: Bounds<Pixels>,+ layout: &LayoutState,+ cx: &mut ViewContext<Editor>,+ ) {+ let bounds = gutter_bounds.union(&text_bounds);+ let scroll_top =+ layout.position_map.snapshot.scroll_position().y * layout.position_map.line_height;- let gutter_bg = cx.theme().colors().editor_gutter;++ let gutter_bg = cx.theme().colors().editor_gutter_background;+ cx.paint_quad(+ gutter_bounds,+ Corners::default(),+ gutter_bg,+ Edges::default(),+ transparent_black(),+ );+ cx.paint_quad(+ text_bounds,+ Corners::default(),+ self.style.background,+ Edges::default(),+ transparent_black(),+ );++ if let EditorMode::Full = layout.mode {+ let mut active_rows = layout.active_rows.iter().peekable();+ while let Some((start_row, contains_non_empty_selection)) = active_rows.next() {+ let mut end_row = *start_row;+ while active_rows.peek().map_or(false, |r| {+ *r.0 == end_row + 1 && r.1 == contains_non_empty_selection+ }) {+ active_rows.next().unwrap();+ end_row += 1;+ }++ if !contains_non_empty_selection {+ let origin = point(+ bounds.origin.x,+ bounds.origin.y + (layout.position_map.line_height * *start_row as f32)+ - scroll_top,+ );+ let size = size(+ bounds.size.width,+ layout.position_map.line_height * (end_row - start_row + 1) as f32,+ );- let active_line_bg = cx.theme().colors().editor_active_line;++ let active_line_bg = cx.theme().colors().editor_active_line_background;+ cx.paint_quad(+ Bounds { origin, size },+ Corners::default(),+ active_line_bg,+ Edges::default(),+ transparent_black(),+ );+ }+ }- // let fold_corner_radius =- // self.style.folds.ellipses.corner_radius_factor * layout.position_map.line_height;- // for (id, range, color) in layout.fold_ranges.iter() {- // self.paint_highlighted_range(- // range.clone(),- // *color,- // fold_corner_radius,- // fold_corner_radius * 2.,- // layout,- // content_origin,- // scroll_top,- // scroll_left,- // bounds,- // cx,- // );+ if let Some(highlighted_rows) = &layout.highlighted_rows {+ let origin = point(+ bounds.origin.x,+ bounds.origin.y+ + (layout.position_map.line_height * highlighted_rows.start as f32)+ - scroll_top,+ );+ let size = size(+ bounds.size.width,+ layout.position_map.line_height * highlighted_rows.len() as f32,+ );- let highlighted_line_bg = cx.theme().colors().editor_highlighted_line;++ let highlighted_line_bg = cx.theme().colors().editor_highlighted_line_background;+ cx.paint_quad(+ Bounds { origin, size },+ Corners::default(),+ highlighted_line_bg,+ Edges::default(),+ transparent_black(),+ );+ }- // for bound in range_to_bounds(- // &range,- // content_origin,- // scroll_left,- // scroll_top,- // &layout.visible_display_row_range,- // line_end_overshoot,- // &layout.position_map,- // ) {- // cx.scene().push_cursor_region(CursorRegion {- // bounds: bound,- // style: CursorStyle::PointingHand,- // });-- // let display_row = range.start.row();-- // let buffer_row = DisplayPoint::new(display_row, 0)- // .to_point(&layout.position_map.snapshot.display_snapshot)- // .row;-- // let view_id = cx.view_id();- // cx.scene().push_mouse_region(- // MouseRegion::new::<FoldMarkers>(view_id, *id as usize, bound)- // .on_click(MouseButton::Left, move |_, editor: &mut Editor, cx| {- // editor.unfold_at(&UnfoldAt { buffer_row }, cx)- // })- // .with_notify_on_hover(true)- // .with_notify_on_click(true),- // )- // }- // }+ let scroll_left =+ layout.position_map.snapshot.scroll_position().x * layout.position_map.em_width;++ for (wrap_position, active) in layout.wrap_guides.iter() {+ let x = (text_bounds.origin.x + *wrap_position + layout.position_map.em_width / 2.)+ - scroll_left;++ if x < text_bounds.origin.x+ || (layout.show_scrollbars && x > self.scrollbar_left(&bounds))+ {+ continue;+ }++ let color = if *active {+ cx.theme().colors().editor_active_wrap_guide+ } else {+ cx.theme().colors().editor_wrap_guide+ };+ cx.paint_quad(+ Bounds {+ origin: point(x, text_bounds.origin.y),+ size: size(px(1.), text_bounds.size.height),+ },+ Corners::default(),+ color,+ Edges::default(),+ transparent_black(),+ );+ }+ }+ }- // for (range, color) in &layout.highlighted_ranges {- // self.paint_highlighted_range(- // range.clone(),- // *color,- // 0.,- // line_end_overshoot,- // layout,- // content_origin,- // scroll_top,- // scroll_left,- // bounds,- // cx,- // );- // }+ fn paint_gutter(+ &mut self,+ bounds: Bounds<Pixels>,+ layout: &LayoutState,+ editor: &mut Editor,+ cx: &mut ViewContext<Editor>,+ ) {+ let line_height = layout.position_map.line_height;- // let mut cursors = SmallVec::<[Cursor; 32]>::new();- // let corner_radius = 0.15 * layout.position_map.line_height;- // let mut invisible_display_ranges = SmallVec::<[Range<DisplayPoint>; 32]>::new();-- // for (selection_style, selections) in &layout.selections {- // for selection in selections {- // self.paint_highlighted_range(- // selection.range.clone(),- // selection_style.selection,- // corner_radius,- // corner_radius * 2.,- // layout,- // content_origin,- // scroll_top,- // scroll_left,- // bounds,- // cx,- // );+ let scroll_position = layout.position_map.snapshot.scroll_position();+ let scroll_top = scroll_position.y * line_height;- // if selection.is_local && !selection.range.is_empty() {- // invisible_display_ranges.push(selection.range.clone());- // }- // if !selection.is_local || editor.show_local_cursors(cx) {- // let cursor_position = selection.head;- // if layout- // .visible_display_row_range- // .contains(&cursor_position.row())- // {- // let cursor_row_layout = &layout.position_map.line_layouts- // [(cursor_position.row() - start_row) as usize]- // .line;- // let cursor_column = cursor_position.column() as usize;-- // let cursor_character_x = cursor_row_layout.x_for_index(cursor_column);- // let mut block_width =- // cursor_row_layout.x_for_index(cursor_column + 1) - cursor_character_x;- // if block_width == 0.0 {- // block_width = layout.position_map.em_width;- // }- // let block_text = if let CursorShape::Block = selection.cursor_shape {- // layout- // .position_map- // .snapshot- // .chars_at(cursor_position)- // .next()- // .and_then(|(character, _)| {- // let font_id =- // cursor_row_layout.font_for_index(cursor_column)?;- // let text = character.to_string();-- // Some(cx.text_layout_cache().layout_str(- // &text,- // cursor_row_layout.font_size(),- // &[(- // text.chars().count(),- // RunStyle {- // font_id,- // color: style.background,- // underline: Default::default(),- // },- // )],- // ))- // })- // } else {- // None- // };+ let show_gutter = matches!(+ ProjectSettings::get_global(cx).git.git_gutter,+ Some(GitGutterSetting::TrackedFiles)+ );- // let x = cursor_character_x - scroll_left;- // let y = cursor_position.row() as f32 * layout.position_map.line_height- // - scroll_top;- // if selection.is_newest {- // editor.pixel_position_of_newest_cursor = Some(vec2f(- // bounds.origin_x() + x + block_width / 2.,- // bounds.origin_y() + y + layout.position_map.line_height / 2.,- // ));- // }- // cursors.push(Cursor {- // color: selection_style.cursor,- // block_width,- // origin: vec2f(x, y),- // line_height: layout.position_map.line_height,- // shape: selection.cursor_shape,- // block_text,- // });- // }- // }- // }- // }+ if show_gutter {+ Self::paint_diff_hunks(bounds, layout, cx);+ }- // if let Some(visible_text_bounds) = bounds.intersection(visible_bounds) {- // for (ix, line_with_invisibles) in layout.position_map.line_layouts.iter().enumerate() {- // let row = start_row + ix as u32;- // line_with_invisibles.draw(- // layout,- // row,- // scroll_top,- // content_origin,- // scroll_left,- // visible_text_bounds,- // whitespace_setting,- // &invisible_display_ranges,- // visible_bounds,- // cx,- // )- // }- // }+ for (ix, line) in layout.line_number_layouts.iter().enumerate() {+ if let Some(line) = line {+ let line_origin = bounds.origin+ + point(+ bounds.size.width - line.width - layout.gutter_padding,+ ix as f32 * line_height - (scroll_top % line_height),+ );- // cx.scene().push_layer(Some(bounds));- // for cursor in cursors {- // cursor.paint(content_origin, cx);- // }- // cx.scene().pop_layer();-- // if let Some((position, context_menu)) = layout.context_menu.as_mut() {- // cx.scene().push_stacking_context(None, None);- // let cursor_row_layout =- // &layout.position_map.line_layouts[(position.row() - start_row) as usize].line;- // let x = cursor_row_layout.x_for_index(position.column() as usize) - scroll_left;- // let y = (position.row() + 1) as f32 * layout.position_map.line_height - scroll_top;- // let mut list_origin = content_origin + vec2f(x, y);- // let list_width = context_menu.size().x();- // let list_height = context_menu.size().y();-- // // Snap the right edge of the list to the right edge of the window if- // // its horizontal bounds overflow.- // if list_origin.x() + list_width > cx.window_size().x() {- // list_origin.set_x((cx.window_size().x() - list_width).max(0.));- // }+ line.paint(line_origin, line_height, cx);+ }+ }- // if list_origin.y() + list_height > bounds.max_y() {- // list_origin.set_y(list_origin.y() - layout.position_map.line_height - list_height);- // }+ // todo!("fold indicators")+ // for (ix, fold_indicator) in layout.fold_indicators.iter_mut().enumerate() {+ // if let Some(indicator) = fold_indicator.as_mut() {+ // let position = point(+ // bounds.width() - layout.gutter_padding,+ // ix as f32 * line_height - (scroll_top % line_height),+ // );+ // let centering_offset = point(+ // (layout.gutter_padding + layout.gutter_margin - indicator.size().x) / 2.,+ // (line_height - indicator.size().y) / 2.,+ // );++ // let indicator_origin = bounds.origin + position + centering_offset;++ // indicator.paint(indicator_origin, visible_bounds, editor, cx);+ // }+ // }- // context_menu.paint(- // list_origin,- // Bounds<Pixels>::from_points(gpui::Point<Pixels>::zero(), vec2f(f32::MAX, f32::MAX)), // Let content bleed outside of editor- // editor,- // cx,- // );+ // todo!("code actions indicator")+ // if let Some((row, indicator)) = layout.code_actions_indicator.as_mut() {+ // let mut x = 0.;+ // let mut y = *row as f32 * line_height - scroll_top;+ // x += ((layout.gutter_padding + layout.gutter_margin) - indicator.size().x) / 2.;+ // y += (line_height - indicator.size().y) / 2.;+ // indicator.paint(bounds.origin + point(x, y), visible_bounds, editor, cx);+ // }+ }- // cx.scene().pop_stacking_context();- // }+ fn paint_diff_hunks(+ bounds: Bounds<Pixels>,+ layout: &LayoutState,+ cx: &mut ViewContext<Editor>,+ ) {+ // todo!()+ // let diff_style = &theme::current(cx).editor.diff.clone();+ // let line_height = layout.position_map.line_height;++ // let scroll_position = layout.position_map.snapshot.scroll_position();+ // let scroll_top = scroll_position.y * line_height;++ // for hunk in &layout.display_hunks {+ // let (display_row_range, status) = match hunk {+ // //TODO: This rendering is entirely a horrible hack+ // &DisplayDiffHunk::Folded { display_row: row } => {+ // let start_y = row as f32 * line_height - scroll_top;+ // let end_y = start_y + line_height;++ // let width = diff_style.removed_width_em * line_height;+ // let highlight_origin = bounds.origin + point(-width, start_y);+ // let highlight_size = point(width * 2., end_y - start_y);+ // let highlight_bounds = Bounds::<Pixels>::new(highlight_origin, highlight_size);++ // cx.paint_quad(Quad {+ // bounds: highlight_bounds,+ // background: Some(diff_style.modified),+ // border: Border::new(0., Color::transparent_black()).into(),+ // corner_radii: (1. * line_height).into(),+ // });++ // continue;+ // }++ // DisplayDiffHunk::Unfolded {+ // display_row_range,+ // status,+ // } => (display_row_range, status),+ // };++ // let color = match status {+ // DiffHunkStatus::Added => diff_style.inserted,+ // DiffHunkStatus::Modified => diff_style.modified,++ // //TODO: This rendering is entirely a horrible hack+ // DiffHunkStatus::Removed => {+ // let row = display_row_range.start;++ // let offset = line_height / 2.;+ // let start_y = row as f32 * line_height - offset - scroll_top;+ // let end_y = start_y + line_height;++ // let width = diff_style.removed_width_em * line_height;+ // let highlight_origin = bounds.origin + point(-width, start_y);+ // let highlight_size = point(width * 2., end_y - start_y);+ // let highlight_bounds = Bounds::<Pixels>::new(highlight_origin, highlight_size);++ // cx.paint_quad(Quad {+ // bounds: highlight_bounds,+ // background: Some(diff_style.deleted),+ // border: Border::new(0., Color::transparent_black()).into(),+ // corner_radii: (1. * line_height).into(),+ // });++ // continue;+ // }+ // };++ // let start_row = display_row_range.start;+ // let end_row = display_row_range.end;++ // let start_y = start_row as f32 * line_height - scroll_top;+ // let end_y = end_row as f32 * line_height - scroll_top;++ // let width = diff_style.width_em * line_height;+ // let highlight_origin = bounds.origin + point(-width, start_y);+ // let highlight_size = point(width * 2., end_y - start_y);+ // let highlight_bounds = Bounds::<Pixels>::new(highlight_origin, highlight_size);++ // cx.paint_quad(Quad {+ // bounds: highlight_bounds,+ // background: Some(color),+ // border: Border::new(0., Color::transparent_black()).into(),+ // corner_radii: (diff_style.corner_radius * line_height).into(),+ // });+ // }+ }- // if let Some((position, hover_popovers)) = layout.hover_popovers.as_mut() {- // cx.scene().push_stacking_context(None, None);-- // // This is safe because we check on layout whether the required row is available- // let hovered_row_layout =- // &layout.position_map.line_layouts[(position.row() - start_row) as usize].line;-- // // Minimum required size: Take the first popover, and add 1.5 times the minimum popover- // // height. This is the size we will use to decide whether to render popovers above or below- // // the hovered line.- // let first_size = hover_popovers[0].size();- // let height_to_reserve = first_size.y()- // + 1.5 * MIN_POPOVER_LINE_HEIGHT as f32 * layout.position_map.line_height;-- // // Compute Hovered Point- // let x = hovered_row_layout.x_for_index(position.column() as usize) - scroll_left;- // let y = position.row() as f32 * layout.position_map.line_height - scroll_top;- // let hovered_point = content_origin + vec2f(x, y);-- // if hovered_point.y() - height_to_reserve > 0.0 {- // // There is enough space above. Render popovers above the hovered point- // let mut current_y = hovered_point.y();- // for hover_popover in hover_popovers {- // let size = hover_popover.size();- // let mut popover_origin = vec2f(hovered_point.x(), current_y - size.y());-- // let x_out_of_bounds = bounds.max_x() - (popover_origin.x() + size.x());- // if x_out_of_bounds < 0.0 {- // popover_origin.set_x(popover_origin.x() + x_out_of_bounds);- // }+ fn paint_text(+ &mut self,+ bounds: Bounds<Pixels>,+ layout: &LayoutState,+ editor: &mut Editor,+ cx: &mut ViewContext<Editor>,+ ) {+ let scroll_position = layout.position_map.snapshot.scroll_position();+ let start_row = layout.visible_display_row_range.start;+ let scroll_top = scroll_position.y * layout.position_map.line_height;+ let max_glyph_width = layout.position_map.em_width;+ let scroll_left = scroll_position.x * max_glyph_width;+ let content_origin = bounds.origin + point(layout.gutter_margin, Pixels::ZERO);+ let line_end_overshoot = 0.15 * layout.position_map.line_height;+ let whitespace_setting = editor.buffer.read(cx).settings_at(0, cx).show_whitespaces;++ // todo!("cursor region")+ // cx.scene().push_cursor_region(CursorRegion {+ // bounds,+ // style: if !editor.link_go_to_definition_state.definitions.is_empty {+ // CursorStyle::PointingHand+ // } else {+ // CursorStyle::IBeam+ // },+ // });++ // todo!("fold ranges")+ // let fold_corner_radius =+ // self.style.folds.ellipses.corner_radius_factor * layout.position_map.line_height;+ // for (id, range, color) in layout.fold_ranges.iter() {+ // self.paint_highlighted_range(+ // range.clone(),+ // *color,+ // fold_corner_radius,+ // fold_corner_radius * 2.,+ // layout,+ // content_origin,+ // scroll_top,+ // scroll_left,+ // bounds,+ // cx,+ // );++ // for bound in range_to_bounds(+ // &range,+ // content_origin,+ // scroll_left,+ // scroll_top,+ // &layout.visible_display_row_range,+ // line_end_overshoot,+ // &layout.position_map,+ // ) {+ // cx.scene().push_cursor_region(CursorRegion {+ // bounds: bound,+ // style: CursorStyle::PointingHand,+ // });++ // let display_row = range.start.row();++ // let buffer_row = DisplayPoint::new(display_row, 0)+ // .to_point(&layout.position_map.snapshot.display_snapshot)+ // .row;++ // let view_id = cx.view_id();+ // cx.scene().push_mouse_region(+ // MouseRegion::new::<FoldMarkers>(view_id, *id as usize, bound)+ // .on_click(MouseButton::Left, move |_, editor: &mut Editor, cx| {+ // editor.unfold_at(&UnfoldAt { buffer_row }, cx)+ // })+ // .with_notify_on_hover(true)+ // .with_notify_on_click(true),+ // )+ // }+ // }- // hover_popover.paint(- // popover_origin,- // Bounds<Pixels>::from_points(gpui::Point<Pixels>::zero(), vec2f(f32::MAX, f32::MAX)), // Let content bleed outside of editor- // editor,- // cx,- // );+ for (range, color) in &layout.highlighted_ranges {+ self.paint_highlighted_range(+ range.clone(),+ *color,+ Pixels::ZERO,+ line_end_overshoot,+ layout,+ content_origin,+ scroll_top,+ scroll_left,+ bounds,+ cx,+ );+ }- // current_y = popover_origin.y() - HOVER_POPOVER_GAP;- // }- // } else {- // // There is not enough space above. Render popovers below the hovered point- // let mut current_y = hovered_point.y() + layout.position_map.line_height;- // for hover_popover in hover_popovers {- // let size = hover_popover.size();- // let mut popover_origin = vec2f(hovered_point.x(), current_y);-- // let x_out_of_bounds = bounds.max_x() - (popover_origin.x() + size.x());- // if x_out_of_bounds < 0.0 {- // popover_origin.set_x(popover_origin.x() + x_out_of_bounds);- // }+ let mut cursors = SmallVec::<[Cursor; 32]>::new();+ let corner_radius = 0.15 * layout.position_map.line_height;+ let mut invisible_display_ranges = SmallVec::<[Range<DisplayPoint>; 32]>::new();++ for (selection_style, selections) in &layout.selections {+ for selection in selections {+ self.paint_highlighted_range(+ selection.range.clone(),+ selection_style.selection,+ corner_radius,+ corner_radius * 2.,+ layout,+ content_origin,+ scroll_top,+ scroll_left,+ bounds,+ cx,+ );- // hover_popover.paint(- // popover_origin,- // Bounds<Pixels>::from_points(gpui::Point<Pixels>::zero(), vec2f(f32::MAX, f32::MAX)), // Let content bleed outside of editor- // editor,- // cx,- // );+ if selection.is_local && !selection.range.is_empty() {+ invisible_display_ranges.push(selection.range.clone());+ }++ if !selection.is_local || editor.show_local_cursors(cx) {+ let cursor_position = selection.head;+ if layout+ .visible_display_row_range+ .contains(&cursor_position.row())+ {+ let cursor_row_layout = &layout.position_map.line_layouts+ [(cursor_position.row() - start_row) as usize]+ .line;+ let cursor_column = cursor_position.column() as usize;++ let cursor_character_x = cursor_row_layout.x_for_index(cursor_column);+ let mut block_width =+ cursor_row_layout.x_for_index(cursor_column + 1) - cursor_character_x;+ if block_width == Pixels::ZERO {+ block_width = layout.position_map.em_width;+ }+ let block_text = if let CursorShape::Block = selection.cursor_shape {+ layout+ .position_map+ .snapshot+ .chars_at(cursor_position)+ .next()+ .and_then(|(character, _)| {+ let text = character.to_string();+ cx.text_system()+ .layout_text(+ &text,+ cursor_row_layout.font_size,+ &[TextRun {+ len: text.len(),+ font: self.style.text.font(),+ color: self.style.background,+ underline: None,+ }],+ None,+ )+ .unwrap()+ .pop()+ })+ } else {+ None+ };++ let x = cursor_character_x - scroll_left;+ let y = cursor_position.row() as f32 * layout.position_map.line_height+ - scroll_top;+ if selection.is_newest {+ editor.pixel_position_of_newest_cursor = Some(point(+ bounds.origin.x + x + block_width / 2.,+ bounds.origin.y + y + layout.position_map.line_height / 2.,+ ));+ }+ cursors.push(Cursor {+ color: selection_style.cursor,+ block_width,+ origin: point(x, y),+ line_height: layout.position_map.line_height,+ shape: selection.cursor_shape,+ block_text,+ });+ }+ }+ }+ }- // current_y = popover_origin.y() + size.y() + HOVER_POPOVER_GAP;- // }- // }+ for (ix, line_with_invisibles) in layout.position_map.line_layouts.iter().enumerate() {+ let row = start_row + ix as u32;+ line_with_invisibles.draw(+ layout,+ row,+ scroll_top,+ content_origin,+ scroll_left,+ whitespace_setting,+ &invisible_display_ranges,+ cx,+ )+ }- // cx.scene().pop_stacking_context();- // }+ cx.stack(9999, |cx| {+ for cursor in cursors {+ cursor.paint(content_origin, cx);+ }+ });+ // cx.scene().push_layer(Some(bounds));++ // cx.scene().pop_layer();++ // if let Some((position, context_menu)) = layout.context_menu.as_mut() {+ // cx.scene().push_stacking_context(None, None);+ // let cursor_row_layout =+ // &layout.position_map.line_layouts[(position.row() - start_row) as usize].line;+ // let x = cursor_row_layout.x_for_index(position.column() as usize) - scroll_left;+ // let y = (position.row() + 1) as f32 * layout.position_map.line_height - scroll_top;+ // let mut list_origin = content_origin + point(x, y);+ // let list_width = context_menu.size().x;+ // let list_height = context_menu.size().y;++ // // Snap the right edge of the list to the right edge of the window if+ // // its horizontal bounds overflow.+ // if list_origin.x + list_width > cx.window_size().x {+ // list_origin.set_x((cx.window_size().x - list_width).max(0.));+ // }++ // if list_origin.y + list_height > bounds.max_y {+ // list_origin+ // .set_y(list_origin.y - layout.position_map.line_height - list_height);+ // }++ // context_menu.paint(+ // list_origin,+ // Bounds::<Pixels>::from_points(+ // gpui::Point::<Pixels>::zero(),+ // point(f32::MAX, f32::MAX),+ // ), // Let content bleed outside of editor+ // editor,+ // cx,+ // );++ // cx.scene().pop_stacking_context();+ // }- // cx.scene().pop_layer();- // }+ // if let Some((position, hover_popovers)) = layout.hover_popovers.as_mut() {+ // cx.scene().push_stacking_context(None, None);++ // // This is safe because we check on layout whether the required row is available+ // let hovered_row_layout =+ // &layout.position_map.line_layouts[(position.row() - start_row) as usize].line;++ // // Minimum required size: Take the first popover, and add 1.5 times the minimum popover+ // // height. This is the size we will use to decide whether to render popovers above or below+ // // the hovered line.+ // let first_size = hover_popovers[0].size();+ // let height_to_reserve = first_size.y+ // + 1.5 * MIN_POPOVER_LINE_HEIGHT as f32 * layout.position_map.line_height;++ // // Compute Hovered Point+ // let x = hovered_row_layout.x_for_index(position.column() as usize) - scroll_left;+ // let y = position.row() as f32 * layout.position_map.line_height - scroll_top;+ // let hovered_point = content_origin + point(x, y);++ // if hovered_point.y - height_to_reserve > 0.0 {+ // // There is enough space above. Render popovers above the hovered point+ // let mut current_y = hovered_point.y;+ // for hover_popover in hover_popovers {+ // let size = hover_popover.size();+ // let mut popover_origin = point(hovered_point.x, current_y - size.y);++ // let x_out_of_bounds = bounds.max_x - (popover_origin.x + size.x);+ // if x_out_of_bounds < 0.0 {+ // popover_origin.set_x(popover_origin.x + x_out_of_bounds);+ // }++ // hover_popover.paint(+ // popover_origin,+ // Bounds::<Pixels>::from_points(+ // gpui::Point::<Pixels>::zero(),+ // point(f32::MAX, f32::MAX),+ // ), // Let content bleed outside of editor+ // editor,+ // cx,+ // );++ // current_y = popover_origin.y - HOVER_POPOVER_GAP;+ // }+ // } else {+ // // There is not enough space above. Render popovers below the hovered point+ // let mut current_y = hovered_point.y + layout.position_map.line_height;+ // for hover_popover in hover_popovers {+ // let size = hover_popover.size();+ // let mut popover_origin = point(hovered_point.x, current_y);++ // let x_out_of_bounds = bounds.max_x - (popover_origin.x + size.x);+ // if x_out_of_bounds < 0.0 {+ // popover_origin.set_x(popover_origin.x + x_out_of_bounds);+ // }++ // hover_popover.paint(+ // popover_origin,+ // Bounds::<Pixels>::from_points(+ // gpui::Point::<Pixels>::zero(),+ // point(f32::MAX, f32::MAX),+ // ), // Let content bleed outside of editor+ // editor,+ // cx,+ // );++ // current_y = popover_origin.y + size.y + HOVER_POPOVER_GAP;+ // }+ // }++ // cx.scene().pop_stacking_context();+ // }+ }- // fn scrollbar_left(&self, bounds: &Bounds<Pixels>) -> f32 {- // bounds.max_x() - self.style.theme.scrollbar.width- // }+ fn scrollbar_left(&self, bounds: &Bounds<Pixels>) -> Pixels {+ bounds.upper_right().x - self.style.scrollbar_width+ }// fn paint_scrollbar(// &mut self,diff --cc crates/gpui2/src/style.rsindex d6aad7e68e6,d2571a32535..551a87624ca--- a/crates/gpui2/src/style.rs+++ b/crates/gpui2/src/style.rs@@@ -1,8 -1,8 +1,8 @@@use crate::{black, phi, point, rems, AbsoluteLength, BorrowAppContext, BorrowWindow, Bounds, ContentMask,- Corners, CornersRefinement, DefiniteLength, Edges, EdgesRefinement, Font, FontFeatures,- FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Result, Rgba,- SharedString, Size, SizeRefinement, Styled, TextRun, ViewContext, WindowContext,+ Corners, CornersRefinement, CursorStyle, DefiniteLength, Edges, EdgesRefinement, Font,- FontFeatures, FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Rems,- Result, Rgba, SharedString, Size, SizeRefinement, Styled, TextRun, ViewContext, WindowContext,++ FontFeatures, FontStyle, FontWeight, Hsla, Length, Pixels, Point, PointRefinement, Result,++ Rgba, SharedString, Size, SizeRefinement, Styled, TextRun, ViewContext, WindowContext,};use refineable::{Cascade, Refineable};use smallvec::SmallVec;diff --cc crates/gpui2/src/styled.rsindex 746211325ac,a272ab95b14..06be0368c02--- a/crates/gpui2/src/styled.rs+++ b/crates/gpui2/src/styled.rs@@@ -1,7 -1,7 +1,7 @@@use crate::{- self as gpui2, hsla, point, px, relative, rems, AbsoluteLength, AlignItems, DefiniteLength,- Display, Fill, FlexDirection, Hsla, JustifyContent, Length, Position, SharedString,- StyleRefinement,- self as gpui, hsla, point, px, relative, rems, AlignItems, CursorStyle, DefiniteLength,- Display, Fill, FlexDirection, Hsla, JustifyContent, Length, Position, Rems, SharedString,- StyleRefinement, Visibility,++ self as gpui, hsla, point, px, relative, rems, AbsoluteLength, AlignItems, CursorStyle,++ DefiniteLength, Display, Fill, FlexDirection, Hsla, JustifyContent, Length, Position,++ SharedString, StyleRefinement, Visibility,};use crate::{BoxShadow, TextStyleRefinement};use smallvec::smallvec;diff --cc crates/theme2/src/colors.rsindex 866d35cb622,1a1fd2e99ec..441f22be815--- a/crates/theme2/src/colors.rs+++ b/crates/theme2/src/colors.rs@@@ -96,22 -82,32 +98,39 @@@ pub struct ThemeColorspub icon_disabled: Hsla,pub icon_placeholder: Hsla,pub icon_accent: Hsla,- pub status_bar: Hsla,- pub title_bar: Hsla,- pub toolbar: Hsla,- pub tab_bar: Hsla,- pub tab_inactive: Hsla,- pub tab_active: Hsla,- pub editor: Hsla,- pub editor_gutter: Hsla,- pub editor_subheader: Hsla,- pub editor_active_line: Hsla,- pub editor_highlighted_line: Hsla,+ pub status_bar_background: Hsla,+ pub title_bar_background: Hsla,+ pub toolbar_background: Hsla,+ pub tab_bar_background: Hsla,+ pub tab_inactive_background: Hsla,+ pub tab_active_background: Hsla,+ pub editor_background: Hsla,++ pub editor_gutter_background: Hsla,+ pub editor_subheader_background: Hsla,- pub editor_active_line: Hsla,++ pub editor_active_line_background: Hsla,++ pub editor_highlighted_line_background: Hsla,+ pub editor_line_number: Hsla,+ pub editor_active_line_number: Hsla,+ pub editor_invisible: Hsla,+ pub editor_wrap_guide: Hsla,+ pub editor_active_wrap_guide: Hsla,+ pub terminal_background: Hsla,+ pub terminal_ansi_bright_black: Hsla,+ pub terminal_ansi_bright_red: Hsla,+ pub terminal_ansi_bright_green: Hsla,+ pub terminal_ansi_bright_yellow: Hsla,+ pub terminal_ansi_bright_blue: Hsla,+ pub terminal_ansi_bright_magenta: Hsla,+ pub terminal_ansi_bright_cyan: Hsla,+ pub terminal_ansi_bright_white: Hsla,+ pub terminal_ansi_black: Hsla,+ pub terminal_ansi_red: Hsla,+ pub terminal_ansi_green: Hsla,+ pub terminal_ansi_yellow: Hsla,+ pub terminal_ansi_blue: Hsla,+ pub terminal_ansi_magenta: Hsla,+ pub terminal_ansi_cyan: Hsla,+ pub terminal_ansi_white: Hsla,}#[derive(Refineable, Clone)]diff --cc crates/theme2/src/default_colors.rsindex 0df1988ead7,53e34acf160..ce6fe25907d--- a/crates/theme2/src/default_colors.rs+++ b/crates/theme2/src/default_colors.rs@@@ -231,22 -233,32 +233,39 @@@ impl ThemeColorsicon_disabled: neutral().light().step_9(),icon_placeholder: neutral().light().step_10(),icon_accent: blue().light().step_11(),- status_bar: neutral().light().step_2(),- title_bar: neutral().light().step_2(),- toolbar: neutral().light().step_1(),- tab_bar: neutral().light().step_2(),- tab_active: neutral().light().step_1(),- tab_inactive: neutral().light().step_2(),- editor: neutral().light().step_1(),- editor_gutter: neutral().light().step_1(), // todo!("pick the right colors")- editor_subheader: neutral().light().step_2(),- editor_active_line: neutral().light_alpha().step_3(),+ status_bar_background: neutral().light().step_2(),+ title_bar_background: neutral().light().step_2(),+ toolbar_background: neutral().light().step_1(),+ tab_bar_background: neutral().light().step_2(),+ tab_active_background: neutral().light().step_1(),+ tab_inactive_background: neutral().light().step_2(),+ editor_background: neutral().light().step_1(),++ editor_gutter_background: neutral().light().step_1(), // todo!("pick the right colors")+ editor_subheader_background: neutral().light().step_2(),- editor_active_line: neutral().light_alpha().step_3(),++ editor_active_line_background: neutral().light_alpha().step_3(),+ editor_line_number: neutral().light_alpha().step_3(), // todo!("pick the right colors")+ editor_active_line_number: neutral().light_alpha().step_3(), // todo!("pick the right colors")- editor_highlighted_line: neutral().light_alpha().step_4(), // todo!("pick the right colors")++ editor_highlighted_line_background: neutral().light_alpha().step_4(), // todo!("pick the right colors")+ editor_invisible: neutral().light_alpha().step_4(), // todo!("pick the right colors")+ editor_wrap_guide: neutral().light_alpha().step_4(), // todo!("pick the right colors")+ editor_active_wrap_guide: neutral().light_alpha().step_4(), // todo!("pick the right colors")+ terminal_background: neutral().light().step_1(),+ terminal_ansi_black: black().light().step_12(),+ terminal_ansi_red: red().light().step_11(),+ terminal_ansi_green: green().light().step_11(),+ terminal_ansi_yellow: yellow().light().step_11(),+ terminal_ansi_blue: blue().light().step_11(),+ terminal_ansi_magenta: violet().light().step_11(),+ terminal_ansi_cyan: cyan().light().step_11(),+ terminal_ansi_white: neutral().light().step_12(),+ terminal_ansi_bright_black: black().light().step_11(),+ terminal_ansi_bright_red: red().light().step_10(),+ terminal_ansi_bright_green: green().light().step_10(),+ terminal_ansi_bright_yellow: yellow().light().step_10(),+ terminal_ansi_bright_blue: blue().light().step_10(),+ terminal_ansi_bright_magenta: violet().light().step_10(),+ terminal_ansi_bright_cyan: cyan().light().step_10(),+ terminal_ansi_bright_white: neutral().light().step_11(),}}@@@ -283,22 -297,32 +304,39 @@@icon_disabled: neutral().dark().step_9(),icon_placeholder: neutral().dark().step_10(),icon_accent: blue().dark().step_11(),- status_bar: neutral().dark().step_2(),- title_bar: neutral().dark().step_2(),- toolbar: neutral().dark().step_1(),- tab_bar: neutral().dark().step_2(),- tab_active: neutral().dark().step_1(),- tab_inactive: neutral().dark().step_2(),- editor: neutral().dark().step_1(),- editor_gutter: neutral().dark().step_1(), // todo!("pick the right colors")- editor_subheader: neutral().dark().step_2(),- editor_active_line: neutral().dark_alpha().step_3(),+ status_bar_background: neutral().dark().step_2(),+ title_bar_background: neutral().dark().step_2(),+ toolbar_background: neutral().dark().step_1(),+ tab_bar_background: neutral().dark().step_2(),+ tab_active_background: neutral().dark().step_1(),+ tab_inactive_background: neutral().dark().step_2(),+ editor_background: neutral().dark().step_1(),++ editor_gutter_background: neutral().dark().step_1(), // todo!("pick the right colors")+ editor_subheader_background: neutral().dark().step_2(),- editor_active_line: neutral().dark_alpha().step_3(),++ editor_active_line_background: neutral().dark_alpha().step_3(),+ editor_line_number: neutral().dark_alpha().step_3(), // todo!("pick the right colors")+ editor_active_line_number: neutral().dark_alpha().step_3(), // todo!("pick the right colors")- editor_highlighted_line: neutral().dark_alpha().step_4(), // todo!("pick the right colors")++ editor_highlighted_line_background: neutral().dark_alpha().step_4(), // todo!("pick the right colors")+ editor_invisible: neutral().dark_alpha().step_4(), // todo!("pick the right colors")+ editor_wrap_guide: neutral().dark_alpha().step_4(), // todo!("pick the right colors")+ editor_active_wrap_guide: neutral().dark_alpha().step_4(), // todo!("pick the right colors")+ terminal_background: neutral().dark().step_1(),+ terminal_ansi_black: black().dark().step_12(),+ terminal_ansi_red: red().dark().step_11(),+ terminal_ansi_green: green().dark().step_11(),+ terminal_ansi_yellow: yellow().dark().step_11(),+ terminal_ansi_blue: blue().dark().step_11(),+ terminal_ansi_magenta: violet().dark().step_11(),+ terminal_ansi_cyan: cyan().dark().step_11(),+ terminal_ansi_white: neutral().dark().step_12(),+ terminal_ansi_bright_black: black().dark().step_11(),+ terminal_ansi_bright_red: red().dark().step_10(),+ terminal_ansi_bright_green: green().dark().step_10(),+ terminal_ansi_bright_yellow: yellow().dark().step_10(),+ terminal_ansi_bright_blue: blue().dark().step_10(),+ terminal_ansi_bright_magenta: violet().dark().step_10(),+ terminal_ansi_bright_cyan: cyan().dark().step_10(),+ terminal_ansi_bright_white: neutral().dark().step_11(),}}}diff --cc crates/theme2/src/theme2.rsindex e2a3885e215,bbeea1817f6..40e782c6179--- a/crates/theme2/src/theme2.rs+++ b/crates/theme2/src/theme2.rs@@@ -5,9 -5,8 +5,10 @@@ mod registrymod scale;mod settings;mod syntax;+ mod themes;+use std::sync::Arc;+use ::settings::Settings;pub use colors::*;pub use default_colors::*;diff --cc crates/theme2/src/themes/mod.rsindex 00000000000,2a00b497852..86fe9f9bb3emode 000000,100644..100644--- a/crates/theme2/src/themes/mod.rs+++ b/crates/theme2/src/themes/mod.rs@@@ -1,0 -1,41 +1,41 @@@-mod andromeda;-mod ayu;-mod dracula;-mod gruvbox;-mod night_owl;-mod nord;-mod notctis;-mod palenight;-mod rose_pine;-mod solarized;-mod synthwave_84;++// mod andromeda;++// mod ayu;++// mod dracula;++// mod gruvbox;++// mod night_owl;++// mod nord;++// mod notctis;++// mod palenight;++// mod rose_pine;++// mod solarized;++// mod synthwave_84;+-pub use andromeda::*;-pub use ayu::*;-pub use dracula::*;-pub use gruvbox::*;-pub use night_owl::*;-pub use nord::*;-pub use notctis::*;-pub use palenight::*;-pub use rose_pine::*;-pub use solarized::*;-pub use synthwave_84::*;++// pub use andromeda::*;++// pub use ayu::*;++// pub use dracula::*;++// pub use gruvbox::*;++// pub use night_owl::*;++// pub use nord::*;++// pub use notctis::*;++// pub use palenight::*;++// pub use rose_pine::*;++// pub use solarized::*;++// pub use synthwave_84::*;++ use crate::ThemeFamily;+-pub(crate) fn all_imported_themes() -> Vec<ThemeFamily> {++pub fn all_imported_themes() -> Vec<ThemeFamily> {+ vec![- rose_pine(),- night_owl(),- andromeda(),- synthwave_84(),- palenight(),- dracula(),- solarized(),- nord(),- notctis(),- ayu(),- gruvbox(),++ // rose_pine(),++ // night_owl(),++ // andromeda(),++ // synthwave_84(),++ // palenight(),++ // dracula(),++ // solarized(),++ // nord(),++ // notctis(),++ // ayu(),++ // gruvbox(),+ ]+ }diff --cc crates/theme_importer/src/theme_printer.rsindex 00000000000,98765d61294..16812625318mode 000000,100644..100644--- a/crates/theme_importer/src/theme_printer.rs+++ b/crates/theme_importer/src/theme_printer.rs@@@ -1,0 -1,384 +1,384 @@@+ use std::fmt::{self, Debug};++ use gpui::{Hsla, Rgba};+ use theme::{+ Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, SyntaxTheme,+ SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant,+ };++ struct RawSyntaxPrinter<'a>(&'a str);++ impl<'a> Debug for RawSyntaxPrinter<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ write!(f, "{}", self.0)+ }+ }++ struct HslaPrinter(Hsla);++ impl Debug for HslaPrinter {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ write!(f, "{:?}", IntoPrinter(&Rgba::from(self.0)))+ }+ }++ struct IntoPrinter<'a, D: Debug>(&'a D);++ impl<'a, D: Debug> Debug for IntoPrinter<'a, D> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ write!(f, "{:?}.into()", self.0)+ }+ }++ pub struct VecPrinter<'a, T>(&'a Vec<T>);++ impl<'a, T: Debug> Debug for VecPrinter<'a, T> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ write!(f, "vec!{:?}", &self.0)+ }+ }++ pub struct ThemeFamilyPrinter(ThemeFamily);++ impl ThemeFamilyPrinter {+ pub fn new(theme_family: ThemeFamily) -> Self {+ Self(theme_family)+ }+ }++ impl Debug for ThemeFamilyPrinter {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_struct("ThemeFamily")+ .field("id", &IntoPrinter(&self.0.id))+ .field("name", &IntoPrinter(&self.0.name))+ .field("author", &IntoPrinter(&self.0.author))+ .field(+ "themes",+ &VecPrinter(+ &self+ .0+ .themes+ .iter()+ .map(|theme| ThemeVariantPrinter(theme))+ .collect(),+ ),+ )+ .field("scales", &RawSyntaxPrinter("default_color_scales()"))+ .finish()+ }+ }++ pub struct ThemeVariantPrinter<'a>(&'a ThemeVariant);++ impl<'a> Debug for ThemeVariantPrinter<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_struct("ThemeVariant")+ .field("id", &IntoPrinter(&self.0.id))+ .field("name", &IntoPrinter(&self.0.name))+ .field("appearance", &AppearancePrinter(self.0.appearance))+ .field("styles", &ThemeStylesPrinter(&self.0.styles))+ .finish()+ }+ }++ pub struct AppearancePrinter(Appearance);++ impl Debug for AppearancePrinter {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ write!(f, "Appearance::{:?}", self.0)+ }+ }++ pub struct ThemeStylesPrinter<'a>(&'a ThemeStyles);++ impl<'a> Debug for ThemeStylesPrinter<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_struct("ThemeStyles")+ .field("system", &SystemColorsPrinter(&self.0.system))+ .field("colors", &ThemeColorsPrinter(&self.0.colors))+ .field("status", &StatusColorsPrinter(&self.0.status))+ .field("git", &GitStatusColorsPrinter(&self.0.git))+ .field("player", &PlayerColorsPrinter(&self.0.player))+ .field("syntax", &SyntaxThemePrinter(&self.0.syntax))+ .finish()+ }+ }++ pub struct SystemColorsPrinter<'a>(&'a SystemColors);++ impl<'a> Debug for SystemColorsPrinter<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_struct("SystemColors")+ .field("transparent", &HslaPrinter(self.0.transparent))+ .field(+ "mac_os_traffic_light_red",+ &HslaPrinter(self.0.mac_os_traffic_light_red),+ )+ .field(+ "mac_os_traffic_light_yellow",+ &HslaPrinter(self.0.mac_os_traffic_light_yellow),+ )+ .field(+ "mac_os_traffic_light_green",+ &HslaPrinter(self.0.mac_os_traffic_light_green),+ )+ .finish()+ }+ }++ pub struct ThemeColorsPrinter<'a>(&'a ThemeColors);++ impl<'a> Debug for ThemeColorsPrinter<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_struct("ThemeColors")+ .field("border", &HslaPrinter(self.0.border))+ .field("border_variant", &HslaPrinter(self.0.border_variant))+ .field("border_focused", &HslaPrinter(self.0.border_focused))+ .field("border_disabled", &HslaPrinter(self.0.border_disabled))+ .field("border_selected", &HslaPrinter(self.0.border_selected))+ .field(+ "border_transparent",+ &HslaPrinter(self.0.border_transparent),+ )+ .field(+ "elevated_surface_background",+ &HslaPrinter(self.0.elevated_surface_background),+ )+ .field(+ "surface_background",+ &HslaPrinter(self.0.surface_background),+ )+ .field("background", &HslaPrinter(self.0.background))+ .field(+ "element_background",+ &HslaPrinter(self.0.element_background),+ )+ .field("element_hover", &HslaPrinter(self.0.element_hover))+ .field("element_active", &HslaPrinter(self.0.element_active))+ .field("element_selected", &HslaPrinter(self.0.element_selected))+ .field("element_disabled", &HslaPrinter(self.0.element_disabled))+ .field(+ "element_placeholder",+ &HslaPrinter(self.0.element_placeholder),+ )+ .field(+ "element_drop_target",+ &HslaPrinter(self.0.element_drop_target),+ )+ .field(+ "ghost_element_background",+ &HslaPrinter(self.0.ghost_element_background),+ )+ .field(+ "ghost_element_hover",+ &HslaPrinter(self.0.ghost_element_hover),+ )+ .field(+ "ghost_element_active",+ &HslaPrinter(self.0.ghost_element_active),+ )+ .field(+ "ghost_element_selected",+ &HslaPrinter(self.0.ghost_element_selected),+ )+ .field(+ "ghost_element_disabled",+ &HslaPrinter(self.0.ghost_element_disabled),+ )+ .field("text", &HslaPrinter(self.0.text))+ .field("text_muted", &HslaPrinter(self.0.text_muted))+ .field("text_placeholder", &HslaPrinter(self.0.text_placeholder))+ .field("text_disabled", &HslaPrinter(self.0.text_disabled))+ .field("text_accent", &HslaPrinter(self.0.text_accent))+ .field("icon", &HslaPrinter(self.0.icon))+ .field("icon_muted", &HslaPrinter(self.0.icon_muted))+ .field("icon_disabled", &HslaPrinter(self.0.icon_disabled))+ .field("icon_placeholder", &HslaPrinter(self.0.icon_placeholder))+ .field("icon_accent", &HslaPrinter(self.0.icon_accent))+ .field(+ "status_bar_background",+ &HslaPrinter(self.0.status_bar_background),+ )+ .field(+ "title_bar_background",+ &HslaPrinter(self.0.title_bar_background),+ )+ .field(+ "toolbar_background",+ &HslaPrinter(self.0.toolbar_background),+ )+ .field(+ "tab_bar_background",+ &HslaPrinter(self.0.tab_bar_background),+ )+ .field(+ "tab_inactive_background",+ &HslaPrinter(self.0.tab_inactive_background),+ )+ .field(+ "tab_active_background",+ &HslaPrinter(self.0.tab_active_background),+ )+ .field("editor_background", &HslaPrinter(self.0.editor_background))+ .field(+ "editor_subheader_background",+ &HslaPrinter(self.0.editor_subheader_background),+ )+ .field(+ "editor_active_line",- &HslaPrinter(self.0.editor_active_line),++ &HslaPrinter(self.0.editor_active_line_background),+ )+ .field(+ "terminal_background",+ &HslaPrinter(self.0.terminal_background),+ )+ .field(+ "terminal_ansi_bright_black",+ &HslaPrinter(self.0.terminal_ansi_bright_black),+ )+ .field(+ "terminal_ansi_bright_red",+ &HslaPrinter(self.0.terminal_ansi_bright_red),+ )+ .field(+ "terminal_ansi_bright_green",+ &HslaPrinter(self.0.terminal_ansi_bright_green),+ )+ .field(+ "terminal_ansi_bright_yellow",+ &HslaPrinter(self.0.terminal_ansi_bright_yellow),+ )+ .field(+ "terminal_ansi_bright_blue",+ &HslaPrinter(self.0.terminal_ansi_bright_blue),+ )+ .field(+ "terminal_ansi_bright_magenta",+ &HslaPrinter(self.0.terminal_ansi_bright_magenta),+ )+ .field(+ "terminal_ansi_bright_cyan",+ &HslaPrinter(self.0.terminal_ansi_bright_cyan),+ )+ .field(+ "terminal_ansi_bright_white",+ &HslaPrinter(self.0.terminal_ansi_bright_white),+ )+ .field(+ "terminal_ansi_black",+ &HslaPrinter(self.0.terminal_ansi_black),+ )+ .field("terminal_ansi_red", &HslaPrinter(self.0.terminal_ansi_red))+ .field(+ "terminal_ansi_green",+ &HslaPrinter(self.0.terminal_ansi_green),+ )+ .field(+ "terminal_ansi_yellow",+ &HslaPrinter(self.0.terminal_ansi_yellow),+ )+ .field(+ "terminal_ansi_blue",+ &HslaPrinter(self.0.terminal_ansi_blue),+ )+ .field(+ "terminal_ansi_magenta",+ &HslaPrinter(self.0.terminal_ansi_magenta),+ )+ .field(+ "terminal_ansi_cyan",+ &HslaPrinter(self.0.terminal_ansi_cyan),+ )+ .field(+ "terminal_ansi_white",+ &HslaPrinter(self.0.terminal_ansi_white),+ )+ .finish()+ }+ }++ pub struct StatusColorsPrinter<'a>(&'a StatusColors);++ impl<'a> Debug for StatusColorsPrinter<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_struct("StatusColors")+ .field("conflict", &HslaPrinter(self.0.conflict))+ .field("created", &HslaPrinter(self.0.created))+ .field("deleted", &HslaPrinter(self.0.deleted))+ .field("error", &HslaPrinter(self.0.error))+ .field("hidden", &HslaPrinter(self.0.hidden))+ .field("ignored", &HslaPrinter(self.0.ignored))+ .field("info", &HslaPrinter(self.0.info))+ .field("modified", &HslaPrinter(self.0.modified))+ .field("renamed", &HslaPrinter(self.0.renamed))+ .field("success", &HslaPrinter(self.0.success))+ .field("warning", &HslaPrinter(self.0.warning))+ .finish()+ }+ }++ pub struct GitStatusColorsPrinter<'a>(&'a GitStatusColors);++ impl<'a> Debug for GitStatusColorsPrinter<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_struct("GitStatusColors")+ .field("conflict", &HslaPrinter(self.0.conflict))+ .field("created", &HslaPrinter(self.0.created))+ .field("deleted", &HslaPrinter(self.0.deleted))+ .field("ignored", &HslaPrinter(self.0.ignored))+ .field("modified", &HslaPrinter(self.0.modified))+ .field("renamed", &HslaPrinter(self.0.renamed))+ .finish()+ }+ }++ pub struct PlayerColorsPrinter<'a>(&'a PlayerColors);++ impl<'a> Debug for PlayerColorsPrinter<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_tuple("PlayerColors")+ .field(&VecPrinter(+ &self+ .0+ .0+ .iter()+ .map(|player_color| PlayerColorPrinter(player_color))+ .collect(),+ ))+ .finish()+ }+ }++ pub struct PlayerColorPrinter<'a>(&'a PlayerColor);++ impl<'a> Debug for PlayerColorPrinter<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_struct("PlayerColor")+ .field("cursor", &HslaPrinter(self.0.cursor))+ .field("background", &HslaPrinter(self.0.background))+ .field("selection", &HslaPrinter(self.0.selection))+ .finish()+ }+ }++ pub struct SyntaxThemePrinter<'a>(&'a SyntaxTheme);++ impl<'a> Debug for SyntaxThemePrinter<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_struct("SyntaxTheme")+ .field(+ "highlights",+ &VecPrinter(+ &self+ .0+ .highlights+ .iter()+ .map(|(token, highlight)| {+ (IntoPrinter(token), HslaPrinter(highlight.color.unwrap()))+ })+ .collect(),+ ),+ )+ .finish()+ }+ }diff --cc crates/ui2/src/to_extract/buffer.rsindex 2b3db676ce7,8ab435e9947..aa4bebc9d5d--- a/crates/ui2/src/to_extract/buffer.rs+++ b/crates/ui2/src/to_extract/buffer.rs@@@ -156,7 -156,7 +156,7 @@@ impl Bufferfn render_row<V: 'static>(row: BufferRow, cx: &WindowContext) -> impl Component<V> {let line_background = if row.current {-- cx.theme().colors().editor_active_line++ cx.theme().colors().editor_active_line_background} else {cx.theme().styles.system.transparent};