diff --git a/Cargo.lock b/Cargo.lock index 7e1b55e9b6a4b5f5d43ac25fc3ddc175193b2f05..a110aef25cb8bb2cee03ac0922bc6e699ae3d400 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2677,7 +2677,7 @@ dependencies = [ "env_logger 0.9.3", "futures 0.3.28", "fuzzy2", - "git", + "git3", "gpui2", "indoc", "itertools 0.10.5", diff --git a/crates/editor2/Cargo.toml b/crates/editor2/Cargo.toml index 121c03ec00922bf9b462630b4b88d34958f9757e..b897110966709ecef886caf8adef36f1973cc4bd 100644 --- a/crates/editor2/Cargo.toml +++ b/crates/editor2/Cargo.toml @@ -31,7 +31,7 @@ drag_and_drop = { path = "../drag_and_drop" } collections = { path = "../collections" } # context_menu = { path = "../context_menu" } fuzzy = { package = "fuzzy2", path = "../fuzzy2" } -git = { path = "../git" } +git = { package = "git3", path = "../git3" } gpui = { package = "gpui2", path = "../gpui2" } language = { package = "language2", path = "../language2" } lsp = { package = "lsp2", path = "../lsp2" } diff --git a/crates/editor2/src/display_map.rs b/crates/editor2/src/display_map.rs index 2955a929f8eacd8c956462627b338eaa19159864..51f5b0a192b6a2bd96468bd496db93efbe0cfe3b 100644 --- a/crates/editor2/src/display_map.rs +++ b/crates/editor2/src/display_map.rs @@ -4,6 +4,7 @@ mod inlay_map; mod tab_map; mod wrap_map; +use crate::EditorStyle; use crate::{ link_go_to_definition::InlayHighlight, movement::TextLayoutDetails, Anchor, AnchorRangeExt, InlayId, MultiBuffer, MultiBufferSnapshot, ToOffset, ToPoint, @@ -11,14 +12,16 @@ use crate::{ pub use block_map::{BlockMap, BlockPoint}; use collections::{BTreeMap, HashMap, HashSet}; use fold_map::FoldMap; -use gpui::{Font, FontId, HighlightStyle, Hsla, Line, Model, ModelContext, Pixels}; +use gpui::{Font, FontId, HighlightStyle, Hsla, Line, Model, ModelContext, Pixels, UnderlineStyle}; use inlay_map::InlayMap; use language::{ language_settings::language_settings, OffsetUtf16, Point, Subscription as BufferSubscription, }; +use lsp::DiagnosticSeverity; use std::{any::TypeId, borrow::Cow, fmt::Debug, num::NonZeroU32, ops::Range, sync::Arc}; use sum_tree::{Bias, TreeMap}; use tab_map::TabMap; +use theme::ThemeVariant; use wrap_map::WrapMap; pub use block_map::{ @@ -35,6 +38,8 @@ pub enum FoldStatus { Foldable, } +const UNNECESSARY_CODE_FADE: f32 = 0.3; + pub trait ToDisplayPoint { fn to_display_point(&self, map: &DisplaySnapshot) -> DisplayPoint; } @@ -496,63 +501,62 @@ impl DisplaySnapshot { ) } - // pub fn highlighted_chunks<'a>( - // &'a self, - // display_rows: Range, - // language_aware: bool, - // style: &'a EditorStyle, - // ) -> impl Iterator> { - // 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, + language_aware: bool, + theme: &'a ThemeVariant, + ) -> impl Iterator> { + self.chunks( + display_rows, + language_aware, + 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 --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rs index 52628f61b58c9ee4411321266c6789b02b98a465..be8375336c604f9ca87f390128ab01c3991b37f1 100644 --- a/crates/editor2/src/editor.rs +++ b/crates/editor2/src/editor.rs @@ -36,9 +36,9 @@ pub use element::{ use futures::FutureExt; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - div, AnyElement, AppContext, BackgroundExecutor, Context, Div, Element, EventEmitter, - FocusHandle, Hsla, Model, Pixels, Render, Styled, Subscription, Task, TextStyle, View, - ViewContext, VisualContext, WeakView, WindowContext, + div, px, AnyElement, AppContext, BackgroundExecutor, Context, Div, Element, EventEmitter, + FocusHandle, FontStyle, FontWeight, Hsla, Model, Pixels, Render, Styled, Subscription, Task, + TextStyle, View, ViewContext, VisualContext, WeakView, WindowContext, }; use highlight_matching_bracket::refresh_matching_bracket_highlights; use hover_popover::{hide_hover, HoverState}; @@ -53,7 +53,7 @@ use language::{ SelectionGoal, TransactionId, }; use link_go_to_definition::{GoToDefinitionLink, InlayHighlight, LinkGoToDefinitionState}; -use lsp::{Documentation, LanguageServerId}; +use lsp::{DiagnosticSeverity, Documentation, LanguageServerId}; pub use multi_buffer::{ Anchor, AnchorRangeExt, ExcerptId, ExcerptRange, MultiBuffer, MultiBufferSnapshot, ToOffset, ToPoint, @@ -72,7 +72,7 @@ use smallvec::SmallVec; use std::{ any::TypeId, borrow::Cow, - cmp::{self, Reverse}, + cmp::{self, Ordering, Reverse}, ops::{ControlFlow, Deref, DerefMut, Range}, path::Path, sync::Arc, @@ -81,7 +81,7 @@ use std::{ pub use sum_tree::Bias; use sum_tree::TreeMap; use text::Rope; -use theme::ThemeColors; +use theme::{ActiveTheme, PlayerColor, ThemeColors, ThemeSettings, ThemeVariant}; use util::{post_inc, RangeExt, ResultExt, TryFutureExt}; use workspace::{ItemNavHistory, SplitDirection, ViewId, Workspace}; @@ -597,11 +597,11 @@ pub enum SoftWrap { #[derive(Clone)] pub struct EditorStyle { + pub background: Hsla, + pub local_player: PlayerColor, pub text: TextStyle, pub line_height_scalar: f32, - // pub placeholder_text: Option, - // pub theme: theme::Editor, - pub theme_id: usize, + pub scrollbar_width: Pixels, } type CompletionId = usize; @@ -634,7 +634,6 @@ pub struct Editor { // override_text_style: Option>, project: Option>, collaboration_hub: Option>, - focused: bool, blink_manager: Model, pub show_local_selections: bool, mode: EditorMode, @@ -1882,7 +1881,7 @@ impl Editor { ) -> Self { // let editor_view_id = cx.view_id(); let style = cx.text_style(); - let font_size = style.font_size * cx.rem_size(); + let font_size = style.font_size.to_pixels(cx.rem_size()); let display_map = cx.build_model(|cx| { // todo!() // let settings = settings::get::(cx); @@ -1940,7 +1939,6 @@ impl Editor { // get_field_editor_theme, collaboration_hub: project.clone().map(|project| Box::new(project) as _), project, - focused: false, blink_manager: blink_manager.clone(), show_local_selections: true, mode, @@ -2211,7 +2209,7 @@ impl Editor { old_cursor_position: &Anchor, cx: &mut ViewContext, ) { - if self.focused && self.leader_peer_id.is_none() { + if self.focus_handle.is_focused(cx) && self.leader_peer_id.is_none() { self.buffer.update(cx, |buffer, cx| { buffer.set_active_selections( &self.selections.disjoint_anchors(), @@ -2458,7 +2456,7 @@ impl Editor { click_count: usize, cx: &mut ViewContext, ) { - if !self.focused { + if !self.focus_handle.is_focused(cx) { cx.focus(&self.focus_handle); } @@ -2524,7 +2522,7 @@ impl Editor { goal_column: u32, cx: &mut ViewContext, ) { - if !self.focused { + if !self.focus_handle.is_focused(cx) { cx.focus(&self.focus_handle); } @@ -3631,7 +3629,7 @@ impl Editor { _ => return, } - if this.focused && menu.is_some() { + if this.focus_handle.is_focused(cx) && menu.is_some() { let menu = menu.unwrap(); *context_menu = Some(ContextMenu::Completions(menu)); drop(context_menu); @@ -4059,12 +4057,12 @@ impl Editor { this.highlight_background::( read_ranges, - |theme| todo!("theme.editor.document_highlight_read_background"), + |theme| theme.editor_document_highlight_read_background, cx, ); this.highlight_background::( write_ranges, - |theme| todo!("theme.editor.document_highlight_write_background"), + |theme| theme.editor_document_highlight_write_background, cx, ); cx.notify(); @@ -8445,13 +8443,13 @@ impl Editor { // } // } - // pub fn highlight_rows(&mut self, rows: Option>) { - // self.highlighted_rows = rows; - // } + pub fn highlight_rows(&mut self, rows: Option>) { + self.highlighted_rows = rows; + } - // pub fn highlighted_rows(&self) -> Option> { - // self.highlighted_rows.clone() - // } + pub fn highlighted_rows(&self) -> Option> { + self.highlighted_rows.clone() + } pub fn highlight_background( &mut self, @@ -8540,43 +8538,43 @@ impl Editor { // }) // } - // pub fn background_highlights_in_range( - // &self, - // search_range: Range, - // display_snapshot: &DisplaySnapshot, - // theme: &Theme, - // ) -> Vec<(Range, Color)> { - // let mut results = Vec::new(); - // for (color_fetcher, ranges) in self.background_highlights.values() { - // let color = color_fetcher(theme); - // let start_ix = match ranges.binary_search_by(|probe| { - // let cmp = probe - // .end - // .cmp(&search_range.start, &display_snapshot.buffer_snapshot); - // if cmp.is_gt() { - // Ordering::Greater - // } else { - // Ordering::Less - // } - // }) { - // Ok(i) | Err(i) => i, - // }; - // for range in &ranges[start_ix..] { - // if range - // .start - // .cmp(&search_range.end, &display_snapshot.buffer_snapshot) - // .is_ge() - // { - // break; - // } + pub fn background_highlights_in_range( + &self, + search_range: Range, + display_snapshot: &DisplaySnapshot, + theme: &ThemeColors, + ) -> Vec<(Range, Hsla)> { + let mut results = Vec::new(); + for (color_fetcher, ranges) in self.background_highlights.values() { + let color = color_fetcher(theme); + let start_ix = match ranges.binary_search_by(|probe| { + let cmp = probe + .end + .cmp(&search_range.start, &display_snapshot.buffer_snapshot); + if cmp.is_gt() { + Ordering::Greater + } else { + Ordering::Less + } + }) { + Ok(i) | Err(i) => i, + }; + for range in &ranges[start_ix..] { + if range + .start + .cmp(&search_range.end, &display_snapshot.buffer_snapshot) + .is_ge() + { + break; + } - // let start = range.start.to_display_point(&display_snapshot); - // let end = range.end.to_display_point(&display_snapshot); - // results.push((start..end, color)) - // } - // } - // results - // } + let start = range.start.to_display_point(&display_snapshot); + let end = range.end.to_display_point(&display_snapshot); + results.push((start..end, color)) + } + } + results + } // pub fn background_highlight_row_ranges( // &self, @@ -8693,9 +8691,9 @@ impl Editor { } } - // pub fn show_local_cursors(&self, cx: &AppContext) -> bool { - // self.blink_manager.read(cx).visible() && self.focused - // } + pub fn show_local_cursors(&self, cx: &WindowContext) -> bool { + self.blink_manager.read(cx).visible() && self.focus_handle.is_focused(cx) + } fn on_buffer_changed(&mut self, _: Model, cx: &mut ViewContext) { cx.notify(); @@ -9325,10 +9323,23 @@ impl Render for Editor { type Element = EditorElement; fn render(&mut self, cx: &mut ViewContext) -> 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 { - 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.), }) } } @@ -9951,23 +9962,19 @@ pub fn highlight_diagnostic_message( (message_without_backticks, highlights) } -// pub fn diagnostic_style( -// severity: DiagnosticSeverity, -// valid: bool, -// theme: &theme::Editor, -// ) -> DiagnosticStyle { -// match (severity, valid) { -// (DiagnosticSeverity::ERROR, true) => theme.error_diagnostic.clone(), -// (DiagnosticSeverity::ERROR, false) => theme.invalid_error_diagnostic.clone(), -// (DiagnosticSeverity::WARNING, true) => theme.warning_diagnostic.clone(), -// (DiagnosticSeverity::WARNING, false) => theme.invalid_warning_diagnostic.clone(), -// (DiagnosticSeverity::INFORMATION, true) => theme.information_diagnostic.clone(), -// (DiagnosticSeverity::INFORMATION, false) => theme.invalid_information_diagnostic.clone(), -// (DiagnosticSeverity::HINT, true) => theme.hint_diagnostic.clone(), -// (DiagnosticSeverity::HINT, false) => theme.invalid_hint_diagnostic.clone(), -// _ => theme.invalid_hint_diagnostic.clone(), -// } -// } +pub fn diagnostic_style(severity: DiagnosticSeverity, valid: bool, theme: &ThemeVariant) -> Hsla { + match (severity, valid) { + (DiagnosticSeverity::ERROR, true) => theme.status().error, + (DiagnosticSeverity::ERROR, false) => theme.status().error, + (DiagnosticSeverity::WARNING, true) => theme.status().warning, + (DiagnosticSeverity::WARNING, false) => theme.status().warning, + (DiagnosticSeverity::INFORMATION, true) => theme.status().info, + (DiagnosticSeverity::INFORMATION, false) => theme.status().info, + (DiagnosticSeverity::HINT, true) => theme.status().info, + (DiagnosticSeverity::HINT, false) => theme.status().info, + _ => theme.status().ignored, + } +} // pub fn combine_syntax_and_fuzzy_match_highlights( // text: &str, diff --git a/crates/editor2/src/element.rs b/crates/editor2/src/element.rs index 6420d1e6cd6482ac99e79f3de0dfbd3c2963359c..b84aedd76a1d8d68f7431304d17444b68b935f77 100644 --- a/crates/editor2/src/element.rs +++ b/crates/editor2/src/element.rs @@ -1,20 +1,34 @@ -use super::{ - display_map::ToDisplayPoint, DisplayPoint, Editor, EditorSnapshot, ToPoint, MAX_LINE_LEN, -}; use crate::{ - display_map::{BlockStyle, DisplaySnapshot}, - EditorMode, EditorStyle, SoftWrap, + display_map::{BlockStyle, DisplaySnapshot, FoldStatus, HighlightedChunk, ToDisplayPoint}, + editor_settings::ShowScrollbar, + git::{diff_hunk_to_display, DisplayDiffHunk}, + CursorShape, DisplayPoint, Editor, EditorMode, EditorSettings, EditorSnapshot, EditorStyle, + Point, Selection, SoftWrap, ToPoint, MAX_LINE_LEN, }; use anyhow::Result; +use collections::{BTreeMap, HashMap}; use gpui::{ - black, point, px, relative, size, AnyElement, Bounds, Element, Hsla, Line, Pixels, Size, Style, - TextRun, TextSystem, ViewContext, + black, hsla, point, px, relative, size, transparent_black, AnyElement, BorrowWindow, Bounds, + ContentMask, Corners, Edges, Element, Hsla, Line, Pixels, ShapedGlyph, Size, Style, TextRun, + TextStyle, TextSystem, ViewContext, WindowContext, }; -use language::{CursorShape, Selection}; +use itertools::Itertools; +use language::language_settings::ShowWhitespaceSetting; +use multi_buffer::Anchor; +use project::project_settings::{GitGutterSetting, ProjectSettings}; +use settings::Settings; use smallvec::SmallVec; -use std::{cmp, ops::Range, sync::Arc}; +use std::{ + borrow::Cow, + cmp::{self, Ordering}, + fmt::Write, + iter, + ops::Range, + sync::Arc, +}; use sum_tree::Bias; -use theme::ActiveTheme; +use theme::{ActiveTheme, PlayerColor}; +use workspace::item::Item; enum FoldMarkers {} @@ -360,29 +374,29 @@ impl EditorElement { // ); // if editor.has_pending_selection() { - // let mut scroll_delta = gpui::Point::zero(); + // let mut scroll_delta = gpui::Point::::zero(); // let vertical_margin = position_map.line_height.min(text_bounds.height() / 3.0); - // let top = text_bounds.origin_y() + vertical_margin; - // let bottom = text_bounds.lower_left().y() - vertical_margin; - // if position.y() < top { - // scroll_delta.set_y(-scale_vertical_mouse_autoscroll_delta(top - position.y())) + // let top = text_bounds.origin.y + vertical_margin; + // let bottom = text_bounds.lower_left().y - vertical_margin; + // if position.y < top { + // scroll_delta.set_y(-scale_vertical_mouse_autoscroll_delta(top - position.y)) // } - // if position.y() > bottom { - // scroll_delta.set_y(scale_vertical_mouse_autoscroll_delta(position.y() - bottom)) + // if position.y > bottom { + // scroll_delta.set_y(scale_vertical_mouse_autoscroll_delta(position.y - bottom)) // } // let horizontal_margin = position_map.line_height.min(text_bounds.width() / 3.0); - // let left = text_bounds.origin_x() + horizontal_margin; - // let right = text_bounds.upper_right().x() - horizontal_margin; - // if position.x() < left { + // let left = text_bounds.origin.x + horizontal_margin; + // let right = text_bounds.upper_right().x - horizontal_margin; + // if position.x < left { // scroll_delta.set_x(-scale_horizontal_mouse_autoscroll_delta( - // left - position.x(), + // left - position.x, // )) // } - // if position.x() > right { + // if position.x > right { // scroll_delta.set_x(scale_horizontal_mouse_autoscroll_delta( - // position.x() - right, + // position.x - right, // )) // } @@ -393,7 +407,7 @@ impl EditorElement { // position: point_for_position.previous_valid, // goal_column: point_for_position.exact_unclipped.column(), // scroll_position: (position_map.snapshot.scroll_position() + scroll_delta) - // .clamp(gpui::Point::zero(), position_map.scroll_max), + // .clamp(gpui::Point::::zero(), position_map.scroll_max), // }, // cx, // ); @@ -471,573 +485,591 @@ impl EditorElement { // position_map.snapshot.ongoing_scroll.filter(&mut delta) // } else { // //Not trackpad - // delta *= vec2f(max_glyph_width, line_height); + // delta *= point(max_glyph_width, line_height); // None //Resets ongoing scroll // }; // let scroll_position = position_map.snapshot.scroll_position(); - // let x = (scroll_position.x() * max_glyph_width - delta.x()) / max_glyph_width; - // let y = (scroll_position.y() * line_height - delta.y()) / line_height; - // let scroll_position = vec2f(x, y).clamp(gpui::Point::zero(), position_map.scroll_max); + // let x = (scroll_position.x * max_glyph_width - delta.x) / max_glyph_width; + // let y = (scroll_position.y * line_height - delta.y) / line_height; + // let scroll_position = point(x, y).clamp(gpui::Point::::zero(), position_map.scroll_max); // editor.scroll(scroll_position, axis, cx); // true // } - // fn paint_background( - // &self, - // gutter_bounds: Bounds, - // text_bounds: Bounds, - // layout: &LayoutState, - // cx: &mut ViewContext, - // ) { - // 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::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::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::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, - // visible_bounds: Bounds, - // layout: &mut LayoutState, - // editor: &mut Editor, - // cx: &mut ViewContext, - // ) { - // 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::(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, layout: &mut LayoutState, cx: &mut ViewContext) { - // 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::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::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::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, - // visible_bounds: Bounds, - // layout: &mut LayoutState, - // editor: &mut Editor, - // cx: &mut ViewContext, - // ) { - // 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, + text_bounds: Bounds, + layout: &LayoutState, + cx: &mut ViewContext, + ) { + 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_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_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_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::(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, + layout: &LayoutState, + editor: &mut Editor, + cx: &mut ViewContext, + ) { + 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; 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::from_points(gpui::Point::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, + layout: &LayoutState, + cx: &mut ViewContext, + ) { + // 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::::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::::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::::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, + layout: &LayoutState, + editor: &mut Editor, + cx: &mut ViewContext, + ) { + 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::(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::from_points(gpui::Point::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; 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::from_points(gpui::Point::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::::from_points( + // gpui::Point::::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::::from_points( + // gpui::Point::::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::::from_points( + // gpui::Point::::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) -> f32 { - // bounds.max_x() - self.style.theme.scrollbar.width - // } + fn scrollbar_left(&self, bounds: &Bounds) -> Pixels { + bounds.upper_right().x - self.style.scrollbar_width + } // fn paint_scrollbar( // &mut self, @@ -1053,9 +1085,9 @@ impl EditorElement { // let style = &self.style.theme.scrollbar; - // let top = bounds.min_y(); - // let bottom = bounds.max_y(); - // let right = bounds.max_x(); + // let top = bounds.min_y; + // let bottom = bounds.max_y; + // let right = bounds.max_x; // let left = self.scrollbar_left(&bounds); // let row_range = &layout.scrollbar_row_range; // let max_row = layout.max_row as f32 + (row_range.end - row_range.start); @@ -1077,11 +1109,11 @@ impl EditorElement { // let thumb_top = y_for_row(row_range.start) - first_row_y_offset; // let thumb_bottom = y_for_row(row_range.end) + first_row_y_offset; - // let track_bounds = Bounds::from_points(vec2f(left, top), vec2f(right, bottom)); - // let thumb_bounds = Bounds::from_points(vec2f(left, thumb_top), vec2f(right, thumb_bottom)); + // let track_bounds = Bounds::::from_points(point(left, top), point(right, bottom)); + // let thumb_bounds = Bounds::::from_points(point(left, thumb_top), point(right, thumb_bottom)); // if layout.show_scrollbars { - // cx.scene().push_quad(Quad { + // cx.paint_quad(Quad { // bounds: track_bounds, // border: style.track.border.into(), // background: style.track.background_color, @@ -1092,7 +1124,7 @@ impl EditorElement { // let scrollbar_theme = &theme.editor.scrollbar; // if layout.is_singleton && scrollbar_settings.selections { // let start_anchor = Anchor::min(); - // let end_anchor = Anchor::max(); + // let end_anchor = Anchor::max; // let color = scrollbar_theme.selections; // let border = Border { // width: 1., @@ -1109,9 +1141,9 @@ impl EditorElement { // if end_y - start_y < 1. { // end_y = start_y + 1.; // } - // let bounds = Bounds::from_points(vec2f(left, start_y), vec2f(right, end_y)); + // let bounds = Bounds::::from_points(point(left, start_y), point(right, end_y)); - // cx.scene().push_quad(Quad { + // cx.paint_quad(Quad { // bounds, // background: Some(color), // border: border.into(), @@ -1153,7 +1185,7 @@ impl EditorElement { // if end_y - start_y < 1. { // end_y = start_y + 1.; // } - // let bounds = Bounds::from_points(vec2f(left, start_y), vec2f(right, end_y)); + // let bounds = Bounds::::from_points(point(left, start_y), point(right, end_y)); // let color = match hunk.status() { // DiffHunkStatus::Added => diff_style.inserted, @@ -1171,7 +1203,7 @@ impl EditorElement { // left: true, // }; - // cx.scene().push_quad(Quad { + // cx.paint_quad(Quad { // bounds, // background: Some(color), // border: border.into(), @@ -1180,7 +1212,7 @@ impl EditorElement { // } // } - // cx.scene().push_quad(Quad { + // cx.paint_quad(Quad { // bounds: thumb_bounds, // border: style.thumb.border.into(), // background: style.thumb.background_color, @@ -1203,7 +1235,7 @@ impl EditorElement { // .on_down(MouseButton::Left, { // let row_range = row_range.clone(); // move |event, editor: &mut Editor, cx| { - // let y = event.position.y(); + // let y = event.position.y; // if y < thumb_top || thumb_bottom < y { // let center_row = ((y - top) * max_row as f32 / height).round() as u32; // let top_row = center_row @@ -1222,12 +1254,12 @@ impl EditorElement { // return; // } - // let y = event.prev_mouse_position.y(); - // let new_y = event.position.y(); + // let y = event.prev_mouse_position.y; + // let new_y = event.position.y; // if thumb_top < y && y < thumb_bottom { // let mut position = editor.scroll_position(cx); - // position.set_y(position.y() + (new_y - y) * (max_row as f32) / height); - // if position.y() < 0.0 { + // position.set_y(position.y + (new_y - y) * (max_row as f32) / height); + // if position.y < 0.0 { // position.set_y(0.); // } // editor.set_scroll_position(position, cx); @@ -1237,65 +1269,65 @@ impl EditorElement { // ); // } - // #[allow(clippy::too_many_arguments)] - // fn paint_highlighted_range( - // &self, - // range: Range, - // color: Color, - // corner_radius: f32, - // line_end_overshoot: f32, - // layout: &LayoutState, - // content_origin: gpui::Point, - // scroll_top: f32, - // scroll_left: f32, - // bounds: Bounds, - // cx: &mut ViewContext, - // ) { - // let start_row = layout.visible_display_row_range.start; - // let end_row = layout.visible_display_row_range.end; - // if range.start != range.end { - // let row_range = if range.end.column() == 0 { - // cmp::max(range.start.row(), start_row)..cmp::min(range.end.row(), end_row) - // } else { - // cmp::max(range.start.row(), start_row)..cmp::min(range.end.row() + 1, end_row) - // }; + #[allow(clippy::too_many_arguments)] + fn paint_highlighted_range( + &self, + range: Range, + color: Hsla, + corner_radius: Pixels, + line_end_overshoot: Pixels, + layout: &LayoutState, + content_origin: gpui::Point, + scroll_top: Pixels, + scroll_left: Pixels, + bounds: Bounds, + cx: &mut ViewContext, + ) { + let start_row = layout.visible_display_row_range.start; + let end_row = layout.visible_display_row_range.end; + if range.start != range.end { + let row_range = if range.end.column() == 0 { + cmp::max(range.start.row(), start_row)..cmp::min(range.end.row(), end_row) + } else { + cmp::max(range.start.row(), start_row)..cmp::min(range.end.row() + 1, end_row) + }; - // let highlighted_range = HighlightedRange { - // color, - // line_height: layout.position_map.line_height, - // corner_radius, - // start_y: content_origin.y() - // + row_range.start as f32 * layout.position_map.line_height - // - scroll_top, - // lines: row_range - // .into_iter() - // .map(|row| { - // let line_layout = - // &layout.position_map.line_layouts[(row - start_row) as usize].line; - // HighlightedRangeLine { - // start_x: if row == range.start.row() { - // content_origin.x() - // + line_layout.x_for_index(range.start.column() as usize) - // - scroll_left - // } else { - // content_origin.x() - scroll_left - // }, - // end_x: if row == range.end.row() { - // content_origin.x() - // + line_layout.x_for_index(range.end.column() as usize) - // - scroll_left - // } else { - // content_origin.x() + line_layout.width() + line_end_overshoot - // - scroll_left - // }, - // } - // }) - // .collect(), - // }; + let highlighted_range = HighlightedRange { + color, + line_height: layout.position_map.line_height, + corner_radius, + start_y: content_origin.y + + row_range.start as f32 * layout.position_map.line_height + - scroll_top, + lines: row_range + .into_iter() + .map(|row| { + let line_layout = + &layout.position_map.line_layouts[(row - start_row) as usize].line; + HighlightedRangeLine { + start_x: if row == range.start.row() { + content_origin.x + + line_layout.x_for_index(range.start.column() as usize) + - scroll_left + } else { + content_origin.x - scroll_left + }, + end_x: if row == range.end.row() { + content_origin.x + + line_layout.x_for_index(range.end.column() as usize) + - scroll_left + } else { + content_origin.x + line_layout.width + line_end_overshoot + - scroll_left + }, + } + }) + .collect(), + }; - // highlighted_range.paint(bounds, cx); - // } - // } + highlighted_range.paint(bounds, cx); + } + } // fn paint_blocks( // &mut self, @@ -1306,17 +1338,17 @@ impl EditorElement { // cx: &mut ViewContext, // ) { // let scroll_position = layout.position_map.snapshot.scroll_position(); - // let scroll_left = scroll_position.x() * layout.position_map.em_width; - // let scroll_top = scroll_position.y() * layout.position_map.line_height; + // let scroll_left = scroll_position.x * layout.position_map.em_width; + // let scroll_top = scroll_position.y * layout.position_map.line_height; // for block in &mut layout.blocks { - // let mut origin = bounds.origin() - // + vec2f( + // let mut origin = bounds.origin + // + point( // 0., // block.row as f32 * layout.position_map.line_height - scroll_top, // ); // if !matches!(block.style, BlockStyle::Sticky) { - // origin += vec2f(-scroll_left, 0.); + // origin += point(-scroll_left, 0.); // } // block.element.paint(origin, visible_bounds, editor, cx); // } @@ -1324,7 +1356,7 @@ impl EditorElement { fn column_pixels(&self, column: usize, cx: &ViewContext) -> Pixels { let style = &self.style; - let font_size = style.text.font_size * cx.rem_size(); + let font_size = style.text.font_size.to_pixels(cx.rem_size()); let layout = cx .text_system() .layout_text( @@ -1350,215 +1382,738 @@ impl EditorElement { //Folds contained in a hunk are ignored apart from shrinking visual size //If a fold contains any hunks then that fold line is marked as modified - // fn layout_git_gutters( - // &self, - // display_rows: Range, - // snapshot: &EditorSnapshot, - // ) -> Vec { - // let buffer_snapshot = &snapshot.buffer_snapshot; - - // let buffer_start_row = DisplayPoint::new(display_rows.start, 0) - // .to_point(snapshot) - // .row; - // let buffer_end_row = DisplayPoint::new(display_rows.end, 0) - // .to_point(snapshot) - // .row; - - // buffer_snapshot - // .git_diff_hunks_in_range(buffer_start_row..buffer_end_row) - // .map(|hunk| diff_hunk_to_display(hunk, snapshot)) - // .dedup() - // .collect() - // } + fn layout_git_gutters( + &self, + display_rows: Range, + snapshot: &EditorSnapshot, + ) -> Vec { + let buffer_snapshot = &snapshot.buffer_snapshot; + + let buffer_start_row = DisplayPoint::new(display_rows.start, 0) + .to_point(snapshot) + .row; + let buffer_end_row = DisplayPoint::new(display_rows.end, 0) + .to_point(snapshot) + .row; + + buffer_snapshot + .git_diff_hunks_in_range(buffer_start_row..buffer_end_row) + .map(|hunk| diff_hunk_to_display(hunk, snapshot)) + .dedup() + .collect() + } - // fn calculate_relative_line_numbers( - // &self, - // snapshot: &EditorSnapshot, - // rows: &Range, - // relative_to: Option, - // ) -> HashMap { - // let mut relative_rows: HashMap = Default::default(); - // let Some(relative_to) = relative_to else { - // return relative_rows; - // }; + fn calculate_relative_line_numbers( + &self, + snapshot: &EditorSnapshot, + rows: &Range, + relative_to: Option, + ) -> HashMap { + let mut relative_rows: HashMap = Default::default(); + let Some(relative_to) = relative_to else { + return relative_rows; + }; - // let start = rows.start.min(relative_to); - // let end = rows.end.max(relative_to); - - // let buffer_rows = snapshot - // .buffer_rows(start) - // .take(1 + (end - start) as usize) - // .collect::>(); - - // let head_idx = relative_to - start; - // let mut delta = 1; - // let mut i = head_idx + 1; - // while i < buffer_rows.len() as u32 { - // if buffer_rows[i as usize].is_some() { - // if rows.contains(&(i + start)) { - // relative_rows.insert(i + start, delta); - // } - // delta += 1; - // } - // i += 1; - // } - // delta = 1; - // i = head_idx.min(buffer_rows.len() as u32 - 1); - // while i > 0 && buffer_rows[i as usize].is_none() { - // i -= 1; - // } + let start = rows.start.min(relative_to); + let end = rows.end.max(relative_to); + + let buffer_rows = snapshot + .buffer_rows(start) + .take(1 + (end - start) as usize) + .collect::>(); + + let head_idx = relative_to - start; + let mut delta = 1; + let mut i = head_idx + 1; + while i < buffer_rows.len() as u32 { + if buffer_rows[i as usize].is_some() { + if rows.contains(&(i + start)) { + relative_rows.insert(i + start, delta); + } + delta += 1; + } + i += 1; + } + delta = 1; + i = head_idx.min(buffer_rows.len() as u32 - 1); + while i > 0 && buffer_rows[i as usize].is_none() { + i -= 1; + } - // while i > 0 { - // i -= 1; - // if buffer_rows[i as usize].is_some() { - // if rows.contains(&(i + start)) { - // relative_rows.insert(i + start, delta); - // } - // delta += 1; - // } - // } + while i > 0 { + i -= 1; + if buffer_rows[i as usize].is_some() { + if rows.contains(&(i + start)) { + relative_rows.insert(i + start, delta); + } + delta += 1; + } + } - // relative_rows - // } + relative_rows + } - // fn layout_line_numbers( - // &self, - // rows: Range, - // active_rows: &BTreeMap, - // newest_selection_head: DisplayPoint, - // is_singleton: bool, - // snapshot: &EditorSnapshot, - // cx: &ViewContext, - // ) -> ( - // Vec>, - // Vec>, - // ) { - // let style = &self.style; - // let include_line_numbers = snapshot.mode == EditorMode::Full; - // let mut line_number_layouts = Vec::with_capacity(rows.len()); - // let mut fold_statuses = Vec::with_capacity(rows.len()); - // let mut line_number = String::new(); - // let is_relative = settings::get::(cx).relative_line_numbers; - // let relative_to = if is_relative { - // Some(newest_selection_head.row()) - // } else { - // None - // }; + fn layout_line_numbers( + &self, + rows: Range, + active_rows: &BTreeMap, + newest_selection_head: DisplayPoint, + is_singleton: bool, + snapshot: &EditorSnapshot, + cx: &ViewContext, + ) -> ( + Vec>, + Vec>, + ) { + let font_size = self.style.text.font_size.to_pixels(cx.rem_size()); + let include_line_numbers = snapshot.mode == EditorMode::Full; + let mut line_number_layouts = Vec::with_capacity(rows.len()); + let mut fold_statuses = Vec::with_capacity(rows.len()); + let mut line_number = String::new(); + let is_relative = EditorSettings::get_global(cx).relative_line_numbers; + let relative_to = if is_relative { + Some(newest_selection_head.row()) + } else { + None + }; - // let relative_rows = self.calculate_relative_line_numbers(&snapshot, &rows, relative_to); + let relative_rows = self.calculate_relative_line_numbers(&snapshot, &rows, relative_to); - // for (ix, row) in snapshot - // .buffer_rows(rows.start) - // .take((rows.end - rows.start) as usize) - // .enumerate() - // { - // let display_row = rows.start + ix as u32; - // let (active, color) = if active_rows.contains_key(&display_row) { - // (true, style.line_number_active) - // } else { - // (false, style.line_number) - // }; - // if let Some(buffer_row) = row { - // if include_line_numbers { - // line_number.clear(); - // let default_number = buffer_row + 1; - // let number = relative_rows - // .get(&(ix as u32 + rows.start)) - // .unwrap_or(&default_number); - // write!(&mut line_number, "{}", number).unwrap(); - // line_number_layouts.push(Some(cx.text_layout_cache().layout_str( - // &line_number, - // style.text.font_size, - // &[( - // line_number.len(), - // RunStyle { - // font_id: style.text.font_id, - // color, - // underline: Default::default(), - // }, - // )], - // ))); - // fold_statuses.push( - // is_singleton - // .then(|| { - // snapshot - // .fold_for_line(buffer_row) - // .map(|fold_status| (fold_status, buffer_row, active)) - // }) - // .flatten(), - // ) - // } - // } else { - // fold_statuses.push(None); - // line_number_layouts.push(None); - // } - // } + for (ix, row) in snapshot + .buffer_rows(rows.start) + .take((rows.end - rows.start) as usize) + .enumerate() + { + let display_row = rows.start + ix as u32; + let (active, color) = if active_rows.contains_key(&display_row) { + (true, cx.theme().colors().editor_active_line_number) + } else { + (false, cx.theme().colors().editor_line_number) + }; + if let Some(buffer_row) = row { + if include_line_numbers { + line_number.clear(); + let default_number = buffer_row + 1; + let number = relative_rows + .get(&(ix as u32 + rows.start)) + .unwrap_or(&default_number); + write!(&mut line_number, "{}", number).unwrap(); + let run = TextRun { + len: line_number.len(), + font: self.style.text.font(), + color, + underline: None, + }; + let layout = cx + .text_system() + .layout_text(&line_number, font_size, &[run], None) + .unwrap() + .pop() + .unwrap(); + line_number_layouts.push(Some(layout)); + fold_statuses.push( + is_singleton + .then(|| { + snapshot + .fold_for_line(buffer_row) + .map(|fold_status| (fold_status, buffer_row, active)) + }) + .flatten(), + ) + } + } else { + fold_statuses.push(None); + line_number_layouts.push(None); + } + } - // (line_number_layouts, fold_statuses) - // } + (line_number_layouts, fold_statuses) + } + + fn layout_lines( + &mut self, + rows: Range, + line_number_layouts: &[Option], + snapshot: &EditorSnapshot, + cx: &ViewContext, + ) -> Vec { + if rows.start >= rows.end { + return Vec::new(); + } + + // When the editor is empty and unfocused, then show the placeholder. + if snapshot.is_empty() { + let font_size = self.style.text.font_size.to_pixels(cx.rem_size()); + let placeholder_color = cx.theme().styles.colors.text_placeholder; + let placeholder_text = snapshot.placeholder_text(); + let placeholder_lines = placeholder_text + .as_ref() + .map_or("", AsRef::as_ref) + .split('\n') + .skip(rows.start as usize) + .chain(iter::repeat("")) + .take(rows.len()); + placeholder_lines + .map(|line| { + let run = TextRun { + len: line.len(), + font: self.style.text.font(), + color: placeholder_color, + underline: Default::default(), + }; + cx.text_system() + .layout_text(line, font_size, &[run], None) + .unwrap() + .pop() + .unwrap() + }) + .map(|line| LineWithInvisibles { + line, + invisibles: Vec::new(), + }) + .collect() + } else { + let style = &self.style; + let chunks = snapshot.highlighted_chunks(rows.clone(), true, cx.theme()); + + LineWithInvisibles::from_chunks( + chunks, + &style.text, + MAX_LINE_LEN, + rows.len() as usize, + line_number_layouts, + snapshot.mode, + cx, + ) + } + } + + fn compute_layout( + &mut self, + editor: &mut Editor, + cx: &mut ViewContext<'_, Editor>, + bounds: Bounds, + ) -> LayoutState { + // let mut size = constraint.max; + // if size.x.is_infinite() { + // unimplemented!("we don't yet handle an infinite width constraint on buffer elements"); + // } + + let snapshot = editor.snapshot(cx); + let style = self.style.clone(); + let font_id = cx.text_system().font_id(&style.text.font()).unwrap(); + let font_size = style.text.font_size.to_pixels(cx.rem_size()); + let line_height = (font_size * style.line_height_scalar).round(); + let em_width = cx + .text_system() + .typographic_bounds(font_id, font_size, 'm') + .unwrap() + .size + .width; + let em_advance = cx + .text_system() + .advance(font_id, font_size, 'm') + .unwrap() + .width; + + let gutter_padding; + let gutter_width; + let gutter_margin; + if snapshot.show_gutter { + let descent = cx.text_system().descent(font_id, font_size).unwrap(); + + let gutter_padding_factor = 3.5; + gutter_padding = (em_width * gutter_padding_factor).round(); + gutter_width = self.max_line_number_width(&snapshot, cx) + gutter_padding * 2.0; + gutter_margin = -descent; + } else { + gutter_padding = Pixels::ZERO; + gutter_width = Pixels::ZERO; + gutter_margin = Pixels::ZERO; + }; + + let text_width = bounds.size.width - gutter_width; + let overscroll = size(em_width, px(0.)); + let snapshot = { + editor.set_visible_line_count((bounds.size.height / line_height).into(), cx); + + let editor_width = text_width - gutter_margin - overscroll.width - em_width; + let wrap_width = match editor.soft_wrap_mode(cx) { + SoftWrap::None => (MAX_LINE_LEN / 2) as f32 * em_advance, + SoftWrap::EditorWidth => editor_width, + SoftWrap::Column(column) => editor_width.min(column as f32 * em_advance), + }; + + if editor.set_wrap_width(Some(wrap_width), cx) { + editor.snapshot(cx) + } else { + snapshot + } + }; + + let wrap_guides = editor + .wrap_guides(cx) + .iter() + .map(|(guide, active)| (self.column_pixels(*guide, cx), *active)) + .collect::>(); + + let scroll_height = Pixels::from(snapshot.max_point().row() + 1) * line_height; + // todo!("this should happen during layout") + let editor_mode = snapshot.mode; + if let EditorMode::AutoHeight { max_lines } = editor_mode { + todo!() + // size.set_y( + // scroll_height + // .min(constraint.max_along(Axis::Vertical)) + // .max(constraint.min_along(Axis::Vertical)) + // .max(line_height) + // .min(line_height * max_lines as f32), + // ) + } else if let EditorMode::SingleLine = editor_mode { + todo!() + // size.set_y(line_height.max(constraint.min_along(Axis::Vertical))) + } + // todo!() + // else if size.y.is_infinite() { + // // size.set_y(scroll_height); + // } + // + let gutter_size = size(gutter_width, bounds.size.height); + let text_size = size(text_width, bounds.size.height); + + let autoscroll_horizontally = + editor.autoscroll_vertically(bounds.size.height, line_height, cx); + let mut snapshot = editor.snapshot(cx); + + let scroll_position = snapshot.scroll_position(); + // The scroll position is a fractional point, the whole number of which represents + // the top of the window in terms of display rows. + let start_row = scroll_position.y as u32; + let height_in_lines = f32::from(bounds.size.height / line_height); + let max_row = snapshot.max_point().row(); + + // Add 1 to ensure selections bleed off screen + let end_row = 1 + cmp::min((scroll_position.y + height_in_lines).ceil() as u32, max_row); + + let start_anchor = if start_row == 0 { + Anchor::min() + } else { + snapshot + .buffer_snapshot + .anchor_before(DisplayPoint::new(start_row, 0).to_offset(&snapshot, Bias::Left)) + }; + let end_anchor = if end_row > max_row { + Anchor::max() + } else { + snapshot + .buffer_snapshot + .anchor_before(DisplayPoint::new(end_row, 0).to_offset(&snapshot, Bias::Right)) + }; + + let mut selections: Vec<(PlayerColor, Vec)> = Vec::new(); + let mut active_rows = BTreeMap::new(); + let mut fold_ranges = Vec::new(); + let is_singleton = editor.is_singleton(cx); + + let highlighted_rows = editor.highlighted_rows(); + let highlighted_ranges = editor.background_highlights_in_range( + start_anchor..end_anchor, + &snapshot.display_snapshot, + cx.theme().colors(), + ); + + fold_ranges.extend( + snapshot + .folds_in_range(start_anchor..end_anchor) + .map(|anchor| { + let start = anchor.start.to_point(&snapshot.buffer_snapshot); + ( + start.row, + start.to_display_point(&snapshot.display_snapshot) + ..anchor.end.to_display_point(&snapshot), + ) + }), + ); + + let mut newest_selection_head = None; + + if editor.show_local_selections { + let mut local_selections: Vec> = editor + .selections + .disjoint_in_range(start_anchor..end_anchor, cx); + local_selections.extend(editor.selections.pending(cx)); + let mut layouts = Vec::new(); + let newest = editor.selections.newest(cx); + for selection in local_selections.drain(..) { + let is_empty = selection.start == selection.end; + let is_newest = selection == newest; + + let layout = SelectionLayout::new( + selection, + editor.selections.line_mode, + editor.cursor_shape, + &snapshot.display_snapshot, + is_newest, + true, + ); + if is_newest { + newest_selection_head = Some(layout.head); + } + + for row in cmp::max(layout.active_rows.start, start_row) + ..=cmp::min(layout.active_rows.end, end_row) + { + let contains_non_empty_selection = active_rows.entry(row).or_insert(!is_empty); + *contains_non_empty_selection |= !is_empty; + } + layouts.push(layout); + } + + selections.push((style.local_player, layouts)); + } + + if let Some(collaboration_hub) = &editor.collaboration_hub { + // When following someone, render the local selections in their color. + if let Some(leader_id) = editor.leader_peer_id { + if let Some(collaborator) = collaboration_hub.collaborators(cx).get(&leader_id) { + if let Some(participant_index) = collaboration_hub + .user_participant_indices(cx) + .get(&collaborator.user_id) + { + if let Some((local_selection_style, _)) = selections.first_mut() { + *local_selection_style = cx + .theme() + .players() + .color_for_participant(participant_index.0); + } + } + } + } + + let mut remote_selections = HashMap::default(); + for selection in snapshot.remote_selections_in_range( + &(start_anchor..end_anchor), + collaboration_hub.as_ref(), + cx, + ) { + let selection_style = if let Some(participant_index) = selection.participant_index { + cx.theme() + .players() + .color_for_participant(participant_index.0) + } else { + cx.theme().players().absent() + }; + + // Don't re-render the leader's selections, since the local selections + // match theirs. + if Some(selection.peer_id) == editor.leader_peer_id { + continue; + } + + remote_selections + .entry(selection.replica_id) + .or_insert((selection_style, Vec::new())) + .1 + .push(SelectionLayout::new( + selection.selection, + selection.line_mode, + selection.cursor_shape, + &snapshot.display_snapshot, + false, + false, + )); + } + + selections.extend(remote_selections.into_values()); + } + + let scrollbar_settings = EditorSettings::get_global(cx).scrollbar; + let show_scrollbars = match scrollbar_settings.show { + ShowScrollbar::Auto => { + // Git + (is_singleton && scrollbar_settings.git_diff && snapshot.buffer_snapshot.has_git_diffs()) + || + // Selections + (is_singleton && scrollbar_settings.selections && !highlighted_ranges.is_empty()) + // Scrollmanager + || editor.scroll_manager.scrollbars_visible() + } + ShowScrollbar::System => editor.scroll_manager.scrollbars_visible(), + ShowScrollbar::Always => true, + ShowScrollbar::Never => false, + }; + + let fold_ranges: Vec<(BufferRow, Range, Hsla)> = fold_ranges + .into_iter() + .map(|(id, fold)| { + todo!("folds!") + // let color = self + // .style + // .folds + // .ellipses + // .background + // .style_for(&mut cx.mouse_state::(id as usize)) + // .color; + + // (id, fold, color) + }) + .collect(); + + let head_for_relative = newest_selection_head.unwrap_or_else(|| { + let newest = editor.selections.newest::(cx); + SelectionLayout::new( + newest, + editor.selections.line_mode, + editor.cursor_shape, + &snapshot.display_snapshot, + true, + true, + ) + .head + }); + + let (line_number_layouts, fold_statuses) = self.layout_line_numbers( + start_row..end_row, + &active_rows, + head_for_relative, + is_singleton, + &snapshot, + cx, + ); + + let display_hunks = self.layout_git_gutters(start_row..end_row, &snapshot); + + let scrollbar_row_range = scroll_position.y..(scroll_position.y + height_in_lines); + + let mut max_visible_line_width = Pixels::ZERO; + let line_layouts = + self.layout_lines(start_row..end_row, &line_number_layouts, &snapshot, cx); + for line_with_invisibles in &line_layouts { + if line_with_invisibles.line.width > max_visible_line_width { + max_visible_line_width = line_with_invisibles.line.width; + } + } + + let longest_line_width = layout_line(snapshot.longest_row(), &snapshot, &style, cx) + .unwrap() + .width; + let scroll_width = longest_line_width.max(max_visible_line_width) + overscroll.width; + // todo!("blocks") + // let (scroll_width, blocks) = self.layout_blocks( + // start_row..end_row, + // &snapshot, + // size.x, + // scroll_width, + // gutter_padding, + // gutter_width, + // em_width, + // gutter_width + gutter_margin, + // line_height, + // &style, + // &line_layouts, + // editor, + // cx, + // ); + + let scroll_max = point( + f32::from((scroll_width - text_size.width) / em_width).max(0.0), + max_row as f32, + ); + + let clamped = editor.scroll_manager.clamp_scroll_left(scroll_max.x); + + let autoscrolled = if autoscroll_horizontally { + editor.autoscroll_horizontally( + start_row, + text_size.width, + scroll_width, + em_width, + &line_layouts, + cx, + ) + } else { + false + }; + + if clamped || autoscrolled { + snapshot = editor.snapshot(cx); + } + + // todo!("context menu") + // let mut context_menu = None; + // let mut code_actions_indicator = None; + // if let Some(newest_selection_head) = newest_selection_head { + // if (start_row..end_row).contains(&newest_selection_head.row()) { + // if editor.context_menu_visible() { + // context_menu = + // editor.render_context_menu(newest_selection_head, style.clone(), cx); + // } + + // let active = matches!( + // editor.context_menu.read().as_ref(), + // Some(crate::ContextMenu::CodeActions(_)) + // ); + + // code_actions_indicator = editor + // .render_code_actions_indicator(&style, active, cx) + // .map(|indicator| (newest_selection_head.row(), indicator)); + // } + // } + + let visible_rows = start_row..start_row + line_layouts.len() as u32; + // todo!("hover") + // let mut hover = editor.hover_state.render( + // &snapshot, + // &style, + // visible_rows, + // editor.workspace.as_ref().map(|(w, _)| w.clone()), + // cx, + // ); + // let mode = editor.mode; + + // todo!("fold_indicators") + // let mut fold_indicators = editor.render_fold_indicators( + // fold_statuses, + // &style, + // editor.gutter_hovered, + // line_height, + // gutter_margin, + // cx, + // ); + + // todo!("context_menu") + // if let Some((_, context_menu)) = context_menu.as_mut() { + // context_menu.layout( + // SizeConstraint { + // min: gpui::Point::::zero(), + // max: point( + // cx.window_size().x * 0.7, + // (12. * line_height).min((size.y - line_height) / 2.), + // ), + // }, + // editor, + // cx, + // ); + // } + + // todo!("code actions") + // if let Some((_, indicator)) = code_actions_indicator.as_mut() { + // indicator.layout( + // SizeConstraint::strict_along( + // Axis::Vertical, + // line_height * style.code_actions.vertical_scale, + // ), + // editor, + // cx, + // ); + // } + + // todo!("fold indicators") + // for fold_indicator in fold_indicators.iter_mut() { + // if let Some(indicator) = fold_indicator.as_mut() { + // indicator.layout( + // SizeConstraint::strict_along( + // Axis::Vertical, + // line_height * style.code_actions.vertical_scale, + // ), + // editor, + // cx, + // ); + // } + // } + + // todo!("hover popovers") + // if let Some((_, hover_popovers)) = hover.as_mut() { + // for hover_popover in hover_popovers.iter_mut() { + // hover_popover.layout( + // SizeConstraint { + // min: gpui::Point::::zero(), + // max: point( + // (120. * em_width) // Default size + // .min(size.x / 2.) // Shrink to half of the editor width + // .max(MIN_POPOVER_CHARACTER_WIDTH * em_width), // Apply minimum width of 20 characters + // (16. * line_height) // Default size + // .min(size.y / 2.) // Shrink to half of the editor height + // .max(MIN_POPOVER_LINE_HEIGHT * line_height), // Apply minimum height of 4 lines + // ), + // }, + // editor, + // cx, + // ); + // } + // } - // fn layout_lines( - // &mut self, - // rows: Range, - // line_number_layouts: &[Option], - // snapshot: &EditorSnapshot, - // cx: &ViewContext, - // ) -> Vec { - // if rows.start >= rows.end { - // return Vec::new(); - // } + let invisible_symbol_font_size = font_size / 2.; + let tab_invisible = cx + .text_system() + .layout_text( + "→", + invisible_symbol_font_size, + &[TextRun { + len: "→".len(), + font: self.style.text.font(), + color: cx.theme().colors().editor_invisible, + underline: None, + }], + None, + ) + .unwrap() + .pop() + .unwrap(); + let space_invisible = cx + .text_system() + .layout_text( + "•", + invisible_symbol_font_size, + &[TextRun { + len: "•".len(), + font: self.style.text.font(), + color: cx.theme().colors().editor_invisible, + underline: None, + }], + None, + ) + .unwrap() + .pop() + .unwrap(); - // // When the editor is empty and unfocused, then show the placeholder. - // if snapshot.is_empty() { - // let placeholder_style = self - // .style - // .placeholder_text - // .as_ref() - // .unwrap_or(&self.style.text); - // let placeholder_text = snapshot.placeholder_text(); - // let placeholder_lines = placeholder_text - // .as_ref() - // .map_or("", AsRef::as_ref) - // .split('\n') - // .skip(rows.start as usize) - // .chain(iter::repeat("")) - // .take(rows.len()); - // placeholder_lines - // .map(|line| { - // cx.text_layout_cache().layout_str( - // line, - // placeholder_style.font_size, - // &[( - // line.len(), - // RunStyle { - // font_id: placeholder_style.font_id, - // color: placeholder_style.color, - // underline: Default::default(), - // }, - // )], - // ) - // }) - // .map(|line| LineWithInvisibles { - // line, - // invisibles: Vec::new(), - // }) - // .collect() - // } else { - // let style = &self.style; - // let chunks = snapshot.highlighted_chunks(rows.clone(), true, style); - - // LineWithInvisibles::from_chunks( - // chunks, - // &style.text, - // cx.text_layout_cache(), - // cx.font_cache(), - // MAX_LINE_LEN, - // rows.len() as usize, - // line_number_layouts, - // snapshot.mode, - // ) - // } - // } + LayoutState { + mode: editor_mode, + position_map: Arc::new(PositionMap { + size: bounds.size, + scroll_max, + line_layouts, + line_height, + em_width, + em_advance, + snapshot, + }), + visible_display_row_range: start_row..end_row, + wrap_guides, + gutter_size, + gutter_padding, + text_size, + scrollbar_row_range, + show_scrollbars, + is_singleton, + max_row, + gutter_margin, + active_rows, + highlighted_rows, + highlighted_ranges, + fold_ranges, + line_number_layouts, + display_hunks, + // blocks, + selections, + // context_menu, + // code_actions_indicator, + // fold_indicators, + tab_invisible, + space_invisible, + // hover_popovers: hover, + } + } // #[allow(clippy::too_many_arguments)] // fn layout_blocks( @@ -1578,7 +2133,7 @@ impl EditorElement { // cx: &mut ViewContext, // ) -> (f32, Vec) { // let mut block_id = 0; - // let scroll_x = snapshot.scroll_anchor.offset.x(); + // let scroll_x = snapshot.scroll_anchor.offset.x; // let (fixed_blocks, non_fixed_blocks) = snapshot // .blocks_in_range(rows.clone()) // .partition::, _>(|(_, block)| match block { @@ -1690,9 +2245,9 @@ impl EditorElement { // let mut parent_path = None; // // Can't use .and_then() because `.file_name()` and `.parent()` return references :( // if let Some(path) = path { - // filename = path.file_name().map(|f| f.to_string_lossy().to_string()); + // filename = path.file_name().map(|f| f.to_string_lossy.to_string()); // parent_path = - // path.parent().map(|p| p.to_string_lossy().to_string() + "/"); + // path.parent().map(|p| p.to_string_lossy.to_string() + "/"); // } // Flex::row() @@ -1734,8 +2289,8 @@ impl EditorElement { // element.layout( // SizeConstraint { - // min: gpui::Point::zero(), - // max: vec2f(width, block.height() as f32 * line_height), + // min: gpui::Point::::zero(), + // max: point(width, block.height() as f32 * line_height), // }, // editor, // cx, @@ -1748,7 +2303,7 @@ impl EditorElement { // for (row, block) in fixed_blocks { // let element = render_block(block, f32::INFINITY, block_id); // block_id += 1; - // fixed_block_max_width = fixed_block_max_width.max(element.size().x() + em_width); + // fixed_block_max_width = fixed_block_max_width.max(element.size().x + em_width); // blocks.push(BlockLayout { // row, // element, @@ -1788,194 +2343,192 @@ pub struct LineWithInvisibles { invisibles: Vec, } -// impl LineWithInvisibles { -// fn from_chunks<'a>( -// chunks: impl Iterator>, -// text_style: &TextStyle, -// text_layout_cache: &TextLayoutCache, -// font_cache: &Arc, -// max_line_len: usize, -// max_line_count: usize, -// line_number_layouts: &[Option], -// editor_mode: EditorMode, -// ) -> Vec { -// let mut layouts = Vec::with_capacity(max_line_count); -// let mut line = String::new(); -// let mut invisibles = Vec::new(); -// let mut styles = Vec::new(); -// let mut non_whitespace_added = false; -// let mut row = 0; -// let mut line_exceeded_max_len = false; -// for highlighted_chunk in chunks.chain([HighlightedChunk { -// chunk: "\n", -// style: None, -// is_tab: false, -// }]) { -// for (ix, mut line_chunk) in highlighted_chunk.chunk.split('\n').enumerate() { -// if ix > 0 { -// layouts.push(Self { -// line: text_layout_cache.layout_str(&line, text_style.font_size, &styles), -// invisibles: invisibles.drain(..).collect(), -// }); - -// line.clear(); -// styles.clear(); -// row += 1; -// line_exceeded_max_len = false; -// non_whitespace_added = false; -// if row == max_line_count { -// return layouts; -// } -// } - -// if !line_chunk.is_empty() && !line_exceeded_max_len { -// let text_style = if let Some(style) = highlighted_chunk.style { -// text_style -// .clone() -// .highlight(style, font_cache) -// .map(Cow::Owned) -// .unwrap_or_else(|_| Cow::Borrowed(text_style)) -// } else { -// Cow::Borrowed(text_style) -// }; - -// if line.len() + line_chunk.len() > max_line_len { -// let mut chunk_len = max_line_len - line.len(); -// while !line_chunk.is_char_boundary(chunk_len) { -// chunk_len -= 1; -// } -// line_chunk = &line_chunk[..chunk_len]; -// line_exceeded_max_len = true; -// } - -// styles.push(( -// line_chunk.len(), -// RunStyle { -// font_id: text_style.font_id, -// color: text_style.color, -// underline: text_style.underline, -// }, -// )); - -// if editor_mode == EditorMode::Full { -// // Line wrap pads its contents with fake whitespaces, -// // avoid printing them -// let inside_wrapped_string = line_number_layouts -// .get(row) -// .and_then(|layout| layout.as_ref()) -// .is_none(); -// if highlighted_chunk.is_tab { -// if non_whitespace_added || !inside_wrapped_string { -// invisibles.push(Invisible::Tab { -// line_start_offset: line.len(), -// }); -// } -// } else { -// invisibles.extend( -// line_chunk -// .chars() -// .enumerate() -// .filter(|(_, line_char)| { -// let is_whitespace = line_char.is_whitespace(); -// non_whitespace_added |= !is_whitespace; -// is_whitespace -// && (non_whitespace_added || !inside_wrapped_string) -// }) -// .map(|(whitespace_index, _)| Invisible::Whitespace { -// line_offset: line.len() + whitespace_index, -// }), -// ) -// } -// } - -// line.push_str(line_chunk); -// } -// } -// } - -// layouts -// } - -// fn draw( -// &self, -// layout: &LayoutState, -// row: u32, -// scroll_top: f32, -// content_origin: gpui::Point, -// scroll_left: f32, -// visible_text_bounds: Bounds, -// whitespace_setting: ShowWhitespaceSetting, -// selection_ranges: &[Range], -// visible_bounds: Bounds, -// cx: &mut ViewContext, -// ) { -// let line_height = layout.position_map.line_height; -// let line_y = row as f32 * line_height - scroll_top; - -// self.line.paint( -// content_origin + vec2f(-scroll_left, line_y), -// visible_text_bounds, -// line_height, -// cx, -// ); +impl LineWithInvisibles { + fn from_chunks<'a>( + chunks: impl Iterator>, + text_style: &TextStyle, + max_line_len: usize, + max_line_count: usize, + line_number_layouts: &[Option], + editor_mode: EditorMode, + cx: &WindowContext, + ) -> Vec { + let mut layouts = Vec::with_capacity(max_line_count); + let mut line = String::new(); + let mut invisibles = Vec::new(); + let mut styles = Vec::new(); + let mut non_whitespace_added = false; + let mut row = 0; + let mut line_exceeded_max_len = false; + let font_size = text_style.font_size.to_pixels(cx.rem_size()); + + for highlighted_chunk in chunks.chain([HighlightedChunk { + chunk: "\n", + style: None, + is_tab: false, + }]) { + for (ix, mut line_chunk) in highlighted_chunk.chunk.split('\n').enumerate() { + if ix > 0 { + let layout = cx + .text_system() + .layout_text(&line, font_size, &styles, None); + layouts.push(Self { + line: layout.unwrap().pop().unwrap(), + invisibles: invisibles.drain(..).collect(), + }); + + line.clear(); + styles.clear(); + row += 1; + line_exceeded_max_len = false; + non_whitespace_added = false; + if row == max_line_count { + return layouts; + } + } + + if !line_chunk.is_empty() && !line_exceeded_max_len { + let text_style = if let Some(style) = highlighted_chunk.style { + text_style + .clone() + .highlight(style) + .map(Cow::Owned) + .unwrap_or_else(|_| Cow::Borrowed(text_style)) + } else { + Cow::Borrowed(text_style) + }; + + if line.len() + line_chunk.len() > max_line_len { + let mut chunk_len = max_line_len - line.len(); + while !line_chunk.is_char_boundary(chunk_len) { + chunk_len -= 1; + } + line_chunk = &line_chunk[..chunk_len]; + line_exceeded_max_len = true; + } + + styles.push(TextRun { + len: line_chunk.len(), + font: text_style.font(), + color: text_style.color, + underline: text_style.underline, + }); + + if editor_mode == EditorMode::Full { + // Line wrap pads its contents with fake whitespaces, + // avoid printing them + let inside_wrapped_string = line_number_layouts + .get(row) + .and_then(|layout| layout.as_ref()) + .is_none(); + if highlighted_chunk.is_tab { + if non_whitespace_added || !inside_wrapped_string { + invisibles.push(Invisible::Tab { + line_start_offset: line.len(), + }); + } + } else { + invisibles.extend( + line_chunk + .chars() + .enumerate() + .filter(|(_, line_char)| { + let is_whitespace = line_char.is_whitespace(); + non_whitespace_added |= !is_whitespace; + is_whitespace + && (non_whitespace_added || !inside_wrapped_string) + }) + .map(|(whitespace_index, _)| Invisible::Whitespace { + line_offset: line.len() + whitespace_index, + }), + ) + } + } + + line.push_str(line_chunk); + } + } + } -// self.draw_invisibles( -// &selection_ranges, -// layout, -// content_origin, -// scroll_left, -// line_y, -// row, -// visible_bounds, -// line_height, -// whitespace_setting, -// cx, -// ); -// } + layouts + } -// fn draw_invisibles( -// &self, -// selection_ranges: &[Range], -// layout: &LayoutState, -// content_origin: gpui::Point, -// scroll_left: f32, -// line_y: f32, -// row: u32, -// visible_bounds: Bounds, -// line_height: f32, -// whitespace_setting: ShowWhitespaceSetting, -// cx: &mut ViewContext, -// ) { -// let allowed_invisibles_regions = match whitespace_setting { -// ShowWhitespaceSetting::None => return, -// ShowWhitespaceSetting::Selection => Some(selection_ranges), -// ShowWhitespaceSetting::All => None, -// }; + fn draw( + &self, + layout: &LayoutState, + row: u32, + scroll_top: Pixels, + content_origin: gpui::Point, + scroll_left: Pixels, + whitespace_setting: ShowWhitespaceSetting, + selection_ranges: &[Range], + cx: &mut ViewContext, + ) { + let line_height = layout.position_map.line_height; + let line_y = line_height * row as f32 - scroll_top; + + self.line.paint( + content_origin + gpui::point(-scroll_left, line_y), + line_height, + cx, + ); + + self.draw_invisibles( + &selection_ranges, + layout, + content_origin, + scroll_left, + line_y, + row, + line_height, + whitespace_setting, + cx, + ); + } -// for invisible in &self.invisibles { -// let (&token_offset, invisible_symbol) = match invisible { -// Invisible::Tab { line_start_offset } => (line_start_offset, &layout.tab_invisible), -// Invisible::Whitespace { line_offset } => (line_offset, &layout.space_invisible), -// }; + fn draw_invisibles( + &self, + selection_ranges: &[Range], + layout: &LayoutState, + content_origin: gpui::Point, + scroll_left: Pixels, + line_y: Pixels, + row: u32, + line_height: Pixels, + whitespace_setting: ShowWhitespaceSetting, + cx: &mut ViewContext, + ) { + let allowed_invisibles_regions = match whitespace_setting { + ShowWhitespaceSetting::None => return, + ShowWhitespaceSetting::Selection => Some(selection_ranges), + ShowWhitespaceSetting::All => None, + }; -// let x_offset = self.line.x_for_index(token_offset); -// let invisible_offset = -// (layout.position_map.em_width - invisible_symbol.width()).max(0.0) / 2.0; -// let origin = content_origin + vec2f(-scroll_left + x_offset + invisible_offset, line_y); + for invisible in &self.invisibles { + let (&token_offset, invisible_symbol) = match invisible { + Invisible::Tab { line_start_offset } => (line_start_offset, &layout.tab_invisible), + Invisible::Whitespace { line_offset } => (line_offset, &layout.space_invisible), + }; -// if let Some(allowed_regions) = allowed_invisibles_regions { -// let invisible_point = DisplayPoint::new(row, token_offset as u32); -// if !allowed_regions -// .iter() -// .any(|region| region.start <= invisible_point && invisible_point < region.end) -// { -// continue; -// } -// } -// invisible_symbol.paint(origin, visible_bounds, line_height, cx); -// } -// } -// } + let x_offset = self.line.x_for_index(token_offset); + let invisible_offset = + (layout.position_map.em_width - invisible_symbol.width).max(Pixels::ZERO) / 2.0; + let origin = + content_origin + gpui::point(-scroll_left + x_offset + invisible_offset, line_y); + + if let Some(allowed_regions) = allowed_invisibles_regions { + let invisible_point = DisplayPoint::new(row, token_offset as u32); + if !allowed_regions + .iter() + .any(|region| region.start <= invisible_point && invisible_point < region.end) + { + continue; + } + } + invisible_symbol.paint(origin, line_height, cx); + } + } +} #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum Invisible { @@ -1992,7 +2545,7 @@ impl Element for EditorElement { fn initialize( &mut self, - view_state: &mut Editor, + editor: &mut Editor, element_state: Option, cx: &mut gpui::ViewContext, ) -> Self::ElementState { @@ -2001,7 +2554,7 @@ impl Element for EditorElement { fn layout( &mut self, - view_state: &mut Editor, + editor: &mut Editor, element_state: &mut Self::ElementState, cx: &mut gpui::ViewContext, ) -> gpui::LayoutId { @@ -2019,121 +2572,23 @@ impl Element for EditorElement { element_state: &mut Self::ElementState, cx: &mut gpui::ViewContext, ) { - // let mut size = constraint.max; - // if size.x().is_infinite() { - // unimplemented!("we don't yet handle an infinite width constraint on buffer elements"); - // } - - let snapshot = editor.snapshot(cx); - let style = self.style.clone(); - let font_id = cx.text_system().font_id(&style.text.font()).unwrap(); - let font_size = style.text.font_size * cx.rem_size(); - let line_height = (font_size * style.line_height_scalar).round(); - let em_width = cx - .text_system() - .typographic_bounds(font_id, font_size, 'm') - .unwrap() - .size - .width; - let em_advance = cx - .text_system() - .advance(font_id, font_size, 'm') - .unwrap() - .width; - - let gutter_padding; - let gutter_width; - let gutter_margin; - if snapshot.show_gutter { - let descent = cx.text_system().descent(font_id, font_size).unwrap(); - - let gutter_padding_factor = 3.5; - gutter_padding = (em_width * gutter_padding_factor).round(); - gutter_width = self.max_line_number_width(&snapshot, cx) + gutter_padding * 2.0; - gutter_margin = -descent; - } else { - gutter_padding = px(0.0); - gutter_width = px(0.0); - gutter_margin = px(0.0); - }; - - let text_width = bounds.size.width - gutter_width; - let overscroll = point(em_width, px(0.)); - let snapshot = { - editor.set_visible_line_count((bounds.size.height / line_height).into(), cx); - - let editor_width = text_width - gutter_margin - overscroll.x - em_width; - let wrap_width = match editor.soft_wrap_mode(cx) { - SoftWrap::None => (MAX_LINE_LEN / 2) as f32 * em_advance, - SoftWrap::EditorWidth => editor_width, - SoftWrap::Column(column) => editor_width.min(column as f32 * em_advance), + let layout = self.compute_layout(editor, cx, bounds); + cx.with_content_mask(ContentMask { bounds }, |cx| { + let gutter_bounds = Bounds { + origin: bounds.origin, + size: layout.gutter_size, + }; + let text_bounds = Bounds { + origin: gutter_bounds.upper_right(), + size: layout.text_size, }; - if editor.set_wrap_width(Some(wrap_width), cx) { - editor.snapshot(cx) - } else { - snapshot + self.paint_background(gutter_bounds, text_bounds, &layout, cx); + if layout.gutter_size.width > Pixels::ZERO { + self.paint_gutter(gutter_bounds, &layout, editor, cx); } - }; - - let wrap_guides = editor - .wrap_guides(cx) - .iter() - .map(|(guide, active)| (self.column_pixels(*guide, cx), *active)) - .collect::>(); - - let scroll_height = Pixels::from(snapshot.max_point().row() + 1) * line_height; - // todo!("this should happen during layout") - if let EditorMode::AutoHeight { max_lines } = snapshot.mode { - todo!() - // size.set_y( - // scroll_height - // .min(constraint.max_along(Axis::Vertical)) - // .max(constraint.min_along(Axis::Vertical)) - // .max(line_height) - // .min(line_height * max_lines as f32), - // ) - } else if let EditorMode::SingleLine = snapshot.mode { - todo!() - // size.set_y(line_height.max(constraint.min_along(Axis::Vertical))) - } - // todo!() - // else if size.y().is_infinite() { - // // size.set_y(scroll_height); - // } - // - let gutter_size = size(gutter_width, bounds.size.height); - let text_size = size(text_width, bounds.size.height); - - let autoscroll_horizontally = - editor.autoscroll_vertically(bounds.size.height, line_height, cx); - let mut snapshot = editor.snapshot(cx); - - let scroll_position = snapshot.scroll_position(); - // The scroll position is a fractional point, the whole number of which represents - // the top of the window in terms of display rows. - let start_row = scroll_position.y as u32; - let height_in_lines = f32::from(bounds.size.height / line_height); - let max_row = snapshot.max_point().row(); - - // Add 1 to ensure selections bleed off screen - let end_row = 1 + cmp::min((scroll_position.y + height_in_lines).ceil() as u32, max_row); - - dbg!(start_row..end_row); - // let text_style = cx.text_style(); - // let layout_text = cx.text_system().layout_text( - // "hello world", - // text_style.font_size * cx.rem_size(), - // &[text_style.to_run("hello world".len())], - // None, - // ); - // let line_height = text_style - // .line_height - // .to_pixels(text_style.font_size.into(), cx.rem_size()); - - // layout_text.unwrap()[0] - // .paint(bounds.origin, line_height, cx) - // .unwrap(); + self.paint_text(text_bounds, &layout, editor, cx); + }); } } @@ -2148,7 +2603,7 @@ impl Element for EditorElement { // cx: &mut ViewContext, // ) -> (gpui::Point, Self::LayoutState) { // let mut size = constraint.max; -// if size.x().is_infinite() { +// if size.x.is_infinite() { // unimplemented!("we don't yet handle an infinite width constraint on buffer elements"); // } @@ -2171,14 +2626,14 @@ impl Element for EditorElement { // gutter_margin = 0.0; // }; -// let text_width = size.x() - gutter_width; +// let text_width = size.x - gutter_width; // let em_width = style.text.em_width(cx.font_cache()); // let em_advance = style.text.em_advance(cx.font_cache()); -// let overscroll = vec2f(em_width, 0.); +// let overscroll = point(em_width, 0.); // let snapshot = { -// editor.set_visible_line_count(size.y() / line_height, cx); +// editor.set_visible_line_count(size.y / line_height, cx); -// let editor_width = text_width - gutter_margin - overscroll.x() - em_width; +// let editor_width = text_width - gutter_margin - overscroll.x - em_width; // let wrap_width = match editor.soft_wrap_mode(cx) { // SoftWrap::None => (MAX_LINE_LEN / 2) as f32 * em_advance, // SoftWrap::EditorWidth => editor_width, @@ -2209,25 +2664,25 @@ impl Element for EditorElement { // ) // } else if let EditorMode::SingleLine = snapshot.mode { // size.set_y(line_height.max(constraint.min_along(Axis::Vertical))) -// } else if size.y().is_infinite() { +// } else if size.y.is_infinite() { // size.set_y(scroll_height); // } -// let gutter_size = vec2f(gutter_width, size.y()); -// let text_size = vec2f(text_width, size.y()); +// let gutter_size = point(gutter_width, size.y); +// let text_size = point(text_width, size.y); -// let autoscroll_horizontally = editor.autoscroll_vertically(size.y(), line_height, cx); +// let autoscroll_horizontally = editor.autoscroll_vertically(size.y, line_height, cx); // let mut snapshot = editor.snapshot(cx); // let scroll_position = snapshot.scroll_position(); // // The scroll position is a fractional point, the whole number of which represents // // the top of the window in terms of display rows. -// let start_row = scroll_position.y() as u32; -// let height_in_lines = size.y() / line_height; +// let start_row = scroll_position.y as u32; +// let height_in_lines = size.y / line_height; // let max_row = snapshot.max_point().row(); // // Add 1 to ensure selections bleed off screen // let end_row = 1 + cmp::min( -// (scroll_position.y() + height_in_lines).ceil() as u32, +// (scroll_position.y + height_in_lines).ceil() as u32, // max_row, // ); @@ -2239,7 +2694,7 @@ impl Element for EditorElement { // .anchor_before(DisplayPoint::new(start_row, 0).to_offset(&snapshot, Bias::Left)) // }; // let end_anchor = if end_row > max_row { -// Anchor::max() +// Anchor::max // } else { // snapshot // .buffer_snapshot @@ -2367,7 +2822,7 @@ impl Element for EditorElement { // (is_singleton && scrollbar_settings.git_diff && snapshot.buffer_snapshot.has_git_diffs()) // || // // Selections -// (is_singleton && scrollbar_settings.selections && !highlighted_ranges.is_empty()) +// (is_singleton && scrollbar_settings.selections && !highlighted_ranges.is_empty) // // Scrollmanager // || editor.scroll_manager.scrollbars_visible() // } @@ -2415,7 +2870,7 @@ impl Element for EditorElement { // let display_hunks = self.layout_git_gutters(start_row..end_row, &snapshot); -// let scrollbar_row_range = scroll_position.y()..(scroll_position.y() + height_in_lines); +// let scrollbar_row_range = scroll_position.y..(scroll_position.y + height_in_lines); // let mut max_visible_line_width = 0.0; // let line_layouts = @@ -2434,12 +2889,12 @@ impl Element for EditorElement { // cx.text_layout_cache(), // ) // .width(); -// let scroll_width = longest_line_width.max(max_visible_line_width) + overscroll.x(); +// let scroll_width = longest_line_width.max(max_visible_line_width) + overscroll.x; // let em_width = style.text.em_width(cx.font_cache()); // let (scroll_width, blocks) = self.layout_blocks( // start_row..end_row, // &snapshot, -// size.x(), +// size.x, // scroll_width, // gutter_padding, // gutter_width, @@ -2452,17 +2907,17 @@ impl Element for EditorElement { // cx, // ); -// let scroll_max = vec2f( -// ((scroll_width - text_size.x()) / em_width).max(0.0), +// let scroll_max = point( +// ((scroll_width - text_size.x) / em_width).max(0.0), // max_row as f32, // ); -// let clamped = editor.scroll_manager.clamp_scroll_left(scroll_max.x()); +// let clamped = editor.scroll_manager.clamp_scroll_left(scroll_max.x); // let autoscrolled = if autoscroll_horizontally { // editor.autoscroll_horizontally( // start_row, -// text_size.x(), +// text_size.x, // scroll_width, // em_width, // &line_layouts, @@ -2520,10 +2975,10 @@ impl Element for EditorElement { // if let Some((_, context_menu)) = context_menu.as_mut() { // context_menu.layout( // SizeConstraint { -// min: gpui::Point::zero(), -// max: vec2f( -// cx.window_size().x() * 0.7, -// (12. * line_height).min((size.y() - line_height) / 2.), +// min: gpui::Point::::zero(), +// max: point( +// cx.window_size().x * 0.7, +// (12. * line_height).min((size.y - line_height) / 2.), // ), // }, // editor, @@ -2559,13 +3014,13 @@ impl Element for EditorElement { // for hover_popover in hover_popovers.iter_mut() { // hover_popover.layout( // SizeConstraint { -// min: gpui::Point::zero(), -// max: vec2f( +// min: gpui::Point::::zero(), +// max: point( // (120. * em_width) // Default size -// .min(size.x() / 2.) // Shrink to half of the editor width +// .min(size.x / 2.) // Shrink to half of the editor width // .max(MIN_POPOVER_CHARACTER_WIDTH * em_width), // Apply minimum width of 20 characters // (16. * line_height) // Default size -// .min(size.y() / 2.) // Shrink to half of the editor height +// .min(size.y / 2.) // Shrink to half of the editor height // .max(MIN_POPOVER_LINE_HEIGHT * line_height), // Apply minimum height of 4 lines // ), // }, @@ -2642,9 +3097,9 @@ impl Element for EditorElement { // let visible_bounds = bounds.intersection(visible_bounds).unwrap_or_default(); // cx.scene().push_layer(Some(visible_bounds)); -// let gutter_bounds = Bounds::new(bounds.origin(), layout.gutter_size); -// let text_bounds = Bounds::new( -// bounds.origin() + vec2f(layout.gutter_size.x(), 0.0), +// let gutter_bounds = Bounds::::new(bounds.origin, layout.gutter_size); +// let text_bounds = Bounds::::new( +// bounds.origin + point(layout.gutter_size.x, 0.0), // layout.text_size, // ); @@ -2659,13 +3114,13 @@ impl Element for EditorElement { // ); // self.paint_background(gutter_bounds, text_bounds, layout, cx); -// if layout.gutter_size.x() > 0. { +// if layout.gutter_size.x > 0. { // self.paint_gutter(gutter_bounds, visible_bounds, layout, editor, cx); // } // self.paint_text(text_bounds, visible_bounds, layout, editor, cx); // cx.scene().push_layer(Some(bounds)); -// if !layout.blocks.is_empty() { +// if !layout.blocks.is_empty { // self.paint_blocks(bounds, visible_bounds, layout, editor, cx); // } // self.paint_scrollbar(bounds, layout, &editor, cx); @@ -2683,15 +3138,15 @@ impl Element for EditorElement { // _: &Editor, // _: &ViewContext, // ) -> Option> { -// let text_bounds = Bounds::new( -// bounds.origin() + vec2f(layout.gutter_size.x(), 0.0), +// let text_bounds = Bounds::::new( +// bounds.origin + point(layout.gutter_size.x, 0.0), // layout.text_size, // ); -// let content_origin = text_bounds.origin() + vec2f(layout.gutter_margin, 0.); +// let content_origin = text_bounds.origin + point(layout.gutter_margin, 0.); // let scroll_position = layout.position_map.snapshot.scroll_position(); -// let start_row = scroll_position.y() as u32; -// let scroll_top = scroll_position.y() * layout.position_map.line_height; -// let scroll_left = scroll_position.x() * layout.position_map.em_width; +// let start_row = scroll_position.y as u32; +// let scroll_top = scroll_position.y * layout.position_map.line_height; +// let scroll_left = scroll_position.x * layout.position_map.em_width; // let range_start = OffsetUtf16(range_utf16.start) // .to_display_point(&layout.position_map.snapshot.display_snapshot); @@ -2706,14 +3161,14 @@ impl Element for EditorElement { // .line; // let range_start_x = line.x_for_index(range_start.column() as usize); // let range_start_y = range_start.row() as f32 * layout.position_map.line_height; -// Some(Bounds::new( +// Some(Bounds::::new( // content_origin -// + vec2f( +// + point( // range_start_x, // range_start_y + layout.position_map.line_height, // ) -// - vec2f(scroll_left, scroll_top), -// vec2f( +// - point(scroll_left, scroll_top), +// point( // layout.position_map.em_width, // layout.position_map.line_height, // ), @@ -2737,39 +3192,39 @@ impl Element for EditorElement { type BufferRow = u32; -// pub struct LayoutState { -// position_map: Arc, -// gutter_size: gpui::Point, -// gutter_padding: f32, -// gutter_margin: f32, -// text_size: gpui::Point, -// mode: EditorMode, -// wrap_guides: SmallVec<[(f32, bool); 2]>, -// visible_display_row_range: Range, -// active_rows: BTreeMap, -// highlighted_rows: Option>, -// line_number_layouts: Vec>, -// display_hunks: Vec, -// blocks: Vec, -// highlighted_ranges: Vec<(Range, Color)>, -// fold_ranges: Vec<(BufferRow, Range, Color)>, -// selections: Vec<(SelectionStyle, Vec)>, -// scrollbar_row_range: Range, -// show_scrollbars: bool, -// is_singleton: bool, -// max_row: u32, -// context_menu: Option<(DisplayPoint, AnyElement)>, -// code_actions_indicator: Option<(u32, AnyElement)>, -// hover_popovers: Option<(DisplayPoint, Vec>)>, -// fold_indicators: Vec>>, -// tab_invisible: Line, -// space_invisible: Line, -// } +pub struct LayoutState { + position_map: Arc, + gutter_size: Size, + gutter_padding: Pixels, + gutter_margin: Pixels, + text_size: gpui::Size, + mode: EditorMode, + wrap_guides: SmallVec<[(Pixels, bool); 2]>, + visible_display_row_range: Range, + active_rows: BTreeMap, + highlighted_rows: Option>, + line_number_layouts: Vec>, + display_hunks: Vec, + // blocks: Vec, + highlighted_ranges: Vec<(Range, Hsla)>, + fold_ranges: Vec<(BufferRow, Range, Hsla)>, + selections: Vec<(PlayerColor, Vec)>, + scrollbar_row_range: Range, + show_scrollbars: bool, + is_singleton: bool, + max_row: u32, + // context_menu: Option<(DisplayPoint, AnyElement)>, + // code_actions_indicator: Option<(u32, AnyElement)>, + // hover_popovers: Option<(DisplayPoint, Vec>)>, + // fold_indicators: Vec>>, + tab_invisible: Line, + space_invisible: Line, +} struct PositionMap { size: Size, line_height: Pixels, - scroll_max: Size, + scroll_max: gpui::Point, em_width: Pixels, em_advance: Pixels, line_layouts: Vec, @@ -2824,7 +3279,7 @@ impl PositionMap { if let Some(ix) = line.index_for_x(x) { (ix as u32, px(0.)) } else { - (line.len as u32, px(0.).max(x - line.width())) + (line.len as u32, px(0.).max(x - line.width)) } } else { (0, x) @@ -2855,9 +3310,8 @@ fn layout_line( row: u32, snapshot: &EditorSnapshot, style: &EditorStyle, - rem_size: Pixels, - text_system: &TextSystem, -) -> Result> { + cx: &WindowContext, +) -> Result { let mut line = snapshot.line(row); if line.len() > MAX_LINE_LEN { @@ -2869,17 +3323,21 @@ fn layout_line( line.truncate(len); } - text_system.layout_text( - &line, - style.text.font_size * rem_size, - &[TextRun { - len: snapshot.line_len(row) as usize, - font: style.text.font(), - color: black(), - underline: Default::default(), - }], - None, - ) + Ok(cx + .text_system() + .layout_text( + &line, + style.text.font_size.to_pixels(cx.rem_size()), + &[TextRun { + len: snapshot.line_len(row) as usize, + font: style.text.font(), + color: Hsla::default(), + underline: None, + }], + None, + )? + .pop() + .unwrap()) } #[derive(Debug)] @@ -2893,69 +3351,76 @@ pub struct Cursor { } impl Cursor { - // pub fn new( - // origin: gpui::Point, - // block_width: f32, - // line_height: f32, - // color: Color, - // shape: CursorShape, - // block_text: Option, - // ) -> Cursor { - // Cursor { - // origin, - // block_width, - // line_height, - // color, - // shape, - // block_text, - // } - // } + pub fn new( + origin: gpui::Point, + block_width: Pixels, + line_height: Pixels, + color: Hsla, + shape: CursorShape, + block_text: Option, + ) -> Cursor { + Cursor { + origin, + block_width, + line_height, + color, + shape, + block_text, + } + } - // pub fn bounding_rect(&self, origin: gpui::Point) -> Bounds { - // Bounds::new( - // self.origin + origin, - // vec2f(self.block_width, self.line_height), - // ) - // } + pub fn bounding_rect(&self, origin: gpui::Point) -> Bounds { + Bounds { + origin: self.origin + origin, + size: size(self.block_width, self.line_height), + } + } - // pub fn paint(&self, origin: gpui::Point, cx: &mut WindowContext) { - // let bounds = match self.shape { - // CursorShape::Bar => Bounds::new(self.origin + origin, vec2f(2.0, self.line_height)), - // CursorShape::Block | CursorShape::Hollow => Bounds::new( - // self.origin + origin, - // vec2f(self.block_width, self.line_height), - // ), - // CursorShape::Underscore => Bounds::new( - // self.origin + origin + gpui::Point::new(0.0, self.line_height - 2.0), - // vec2f(self.block_width, 2.0), - // ), - // }; + pub fn paint(&self, origin: gpui::Point, cx: &mut WindowContext) { + let bounds = match self.shape { + CursorShape::Bar => Bounds { + origin: self.origin + origin, + size: size(px(2.0), self.line_height), + }, + CursorShape::Block | CursorShape::Hollow => Bounds { + origin: self.origin + origin, + size: size(self.block_width, self.line_height), + }, + CursorShape::Underscore => Bounds { + origin: self.origin + + origin + + gpui::Point::new(Pixels::ZERO, self.line_height - px(2.0)), + size: size(self.block_width, px(2.0)), + }, + }; - // //Draw background or border quad - // if matches!(self.shape, CursorShape::Hollow) { - // cx.scene().push_quad(Quad { - // bounds, - // background: None, - // border: Border::all(1., self.color).into(), - // corner_radii: Default::default(), - // }); - // } else { - // cx.scene().push_quad(Quad { - // bounds, - // background: Some(self.color), - // border: Default::default(), - // corner_radii: Default::default(), - // }); - // } + //Draw background or border quad + if matches!(self.shape, CursorShape::Hollow) { + cx.paint_quad( + bounds, + Corners::default(), + transparent_black(), + Edges::all(px(1.)), + self.color, + ); + } else { + cx.paint_quad( + bounds, + Corners::default(), + self.color, + Edges::default(), + transparent_black(), + ); + } - // if let Some(block_text) = &self.block_text { - // block_text.paint(self.origin + origin, bounds, self.line_height, cx); - // } - // } + if let Some(block_text) = &self.block_text { + block_text.paint(self.origin + origin, self.line_height, cx); + } + } - // pub fn shape(&self) -> CursorShape { - // self.shape - // } + pub fn shape(&self) -> CursorShape { + self.shape + } } #[derive(Debug)] @@ -2969,130 +3434,129 @@ pub struct HighlightedRange { #[derive(Debug)] pub struct HighlightedRangeLine { - pub start_x: f32, - pub end_x: f32, + pub start_x: Pixels, + pub end_x: Pixels, } impl HighlightedRange { - // pub fn paint(&self, bounds: Bounds, cx: &mut WindowContext) { - // if self.lines.len() >= 2 && self.lines[0].start_x > self.lines[1].end_x { - // self.paint_lines(self.start_y, &self.lines[0..1], bounds, cx); - // self.paint_lines( - // self.start_y + self.line_height, - // &self.lines[1..], - // bounds, - // cx, - // ); - // } else { - // self.paint_lines(self.start_y, &self.lines, bounds, cx); - // } - // } - - // fn paint_lines( - // &self, - // start_y: f32, - // lines: &[HighlightedRangeLine], - // bounds: Bounds, - // cx: &mut WindowContext, - // ) { - // if lines.is_empty() { - // return; - // } - - // let mut path = PathBuilder::new(); - // let first_line = lines.first().unwrap(); - // let last_line = lines.last().unwrap(); - - // let first_top_left = vec2f(first_line.start_x, start_y); - // let first_top_right = vec2f(first_line.end_x, start_y); - - // let curve_height = vec2f(0., self.corner_radius); - // let curve_width = |start_x: f32, end_x: f32| { - // let max = (end_x - start_x) / 2.; - // let width = if max < self.corner_radius { - // max - // } else { - // self.corner_radius - // }; + pub fn paint(&self, bounds: Bounds, cx: &mut WindowContext) { + if self.lines.len() >= 2 && self.lines[0].start_x > self.lines[1].end_x { + self.paint_lines(self.start_y, &self.lines[0..1], bounds, cx); + self.paint_lines( + self.start_y + self.line_height, + &self.lines[1..], + bounds, + cx, + ); + } else { + self.paint_lines(self.start_y, &self.lines, bounds, cx); + } + } - // vec2f(width, 0.) - // }; + fn paint_lines( + &self, + start_y: Pixels, + lines: &[HighlightedRangeLine], + bounds: Bounds, + cx: &mut WindowContext, + ) { + if lines.is_empty() { + return; + } - // let top_curve_width = curve_width(first_line.start_x, first_line.end_x); - // path.reset(first_top_right - top_curve_width); - // path.curve_to(first_top_right + curve_height, first_top_right); + let first_line = lines.first().unwrap(); + let last_line = lines.last().unwrap(); - // let mut iter = lines.iter().enumerate().peekable(); - // while let Some((ix, line)) = iter.next() { - // let bottom_right = vec2f(line.end_x, start_y + (ix + 1) as f32 * self.line_height); + let first_top_left = point(first_line.start_x, start_y); + let first_top_right = point(first_line.end_x, start_y); - // if let Some((_, next_line)) = iter.peek() { - // let next_top_right = vec2f(next_line.end_x, bottom_right.y()); + let curve_height = point(Pixels::ZERO, self.corner_radius); + let curve_width = |start_x: Pixels, end_x: Pixels| { + let max = (end_x - start_x) / 2.; + let width = if max < self.corner_radius { + max + } else { + self.corner_radius + }; - // match next_top_right.x().partial_cmp(&bottom_right.x()).unwrap() { - // Ordering::Equal => { - // path.line_to(bottom_right); - // } - // Ordering::Less => { - // let curve_width = curve_width(next_top_right.x(), bottom_right.x()); - // path.line_to(bottom_right - curve_height); - // if self.corner_radius > 0. { - // path.curve_to(bottom_right - curve_width, bottom_right); - // } - // path.line_to(next_top_right + curve_width); - // if self.corner_radius > 0. { - // path.curve_to(next_top_right + curve_height, next_top_right); - // } - // } - // Ordering::Greater => { - // let curve_width = curve_width(bottom_right.x(), next_top_right.x()); - // path.line_to(bottom_right - curve_height); - // if self.corner_radius > 0. { - // path.curve_to(bottom_right + curve_width, bottom_right); - // } - // path.line_to(next_top_right - curve_width); - // if self.corner_radius > 0. { - // path.curve_to(next_top_right + curve_height, next_top_right); - // } - // } - // } - // } else { - // let curve_width = curve_width(line.start_x, line.end_x); - // path.line_to(bottom_right - curve_height); - // if self.corner_radius > 0. { - // path.curve_to(bottom_right - curve_width, bottom_right); - // } + point(width, Pixels::ZERO) + }; - // let bottom_left = vec2f(line.start_x, bottom_right.y()); - // path.line_to(bottom_left + curve_width); - // if self.corner_radius > 0. { - // path.curve_to(bottom_left - curve_height, bottom_left); - // } - // } - // } + let top_curve_width = curve_width(first_line.start_x, first_line.end_x); + let mut path = gpui::Path::new(first_top_right - top_curve_width); + path.curve_to(first_top_right + curve_height, first_top_right); + + let mut iter = lines.iter().enumerate().peekable(); + while let Some((ix, line)) = iter.next() { + let bottom_right = point(line.end_x, start_y + (ix + 1) as f32 * self.line_height); + + if let Some((_, next_line)) = iter.peek() { + let next_top_right = point(next_line.end_x, bottom_right.y); + + match next_top_right.x.partial_cmp(&bottom_right.x).unwrap() { + Ordering::Equal => { + path.line_to(bottom_right); + } + Ordering::Less => { + let curve_width = curve_width(next_top_right.x, bottom_right.x); + path.line_to(bottom_right - curve_height); + if self.corner_radius > Pixels::ZERO { + path.curve_to(bottom_right - curve_width, bottom_right); + } + path.line_to(next_top_right + curve_width); + if self.corner_radius > Pixels::ZERO { + path.curve_to(next_top_right + curve_height, next_top_right); + } + } + Ordering::Greater => { + let curve_width = curve_width(bottom_right.x, next_top_right.x); + path.line_to(bottom_right - curve_height); + if self.corner_radius > Pixels::ZERO { + path.curve_to(bottom_right + curve_width, bottom_right); + } + path.line_to(next_top_right - curve_width); + if self.corner_radius > Pixels::ZERO { + path.curve_to(next_top_right + curve_height, next_top_right); + } + } + } + } else { + let curve_width = curve_width(line.start_x, line.end_x); + path.line_to(bottom_right - curve_height); + if self.corner_radius > Pixels::ZERO { + path.curve_to(bottom_right - curve_width, bottom_right); + } + + let bottom_left = point(line.start_x, bottom_right.y); + path.line_to(bottom_left + curve_width); + if self.corner_radius > Pixels::ZERO { + path.curve_to(bottom_left - curve_height, bottom_left); + } + } + } - // if first_line.start_x > last_line.start_x { - // let curve_width = curve_width(last_line.start_x, first_line.start_x); - // let second_top_left = vec2f(last_line.start_x, start_y + self.line_height); - // path.line_to(second_top_left + curve_height); - // if self.corner_radius > 0. { - // path.curve_to(second_top_left + curve_width, second_top_left); - // } - // let first_bottom_left = vec2f(first_line.start_x, second_top_left.y()); - // path.line_to(first_bottom_left - curve_width); - // if self.corner_radius > 0. { - // path.curve_to(first_bottom_left - curve_height, first_bottom_left); - // } - // } + if first_line.start_x > last_line.start_x { + let curve_width = curve_width(last_line.start_x, first_line.start_x); + let second_top_left = point(last_line.start_x, start_y + self.line_height); + path.line_to(second_top_left + curve_height); + if self.corner_radius > Pixels::ZERO { + path.curve_to(second_top_left + curve_width, second_top_left); + } + let first_bottom_left = point(first_line.start_x, second_top_left.y); + path.line_to(first_bottom_left - curve_width); + if self.corner_radius > Pixels::ZERO { + path.curve_to(first_bottom_left - curve_height, first_bottom_left); + } + } - // path.line_to(first_top_left + curve_height); - // if self.corner_radius > 0. { - // path.curve_to(first_top_left + top_curve_width, first_top_left); - // } - // path.line_to(first_top_right - top_curve_width); + path.line_to(first_top_left + curve_height); + if self.corner_radius > Pixels::ZERO { + path.curve_to(first_top_left + top_curve_width, first_top_left); + } + path.line_to(first_top_right - top_curve_width); - // cx.scene().push_path(path.build(self.color, Some(bounds))); - // } + cx.paint_path(path, self.color); + } } // fn range_to_bounds( @@ -3120,27 +3584,27 @@ impl HighlightedRange { // }; // let first_y = -// content_origin.y() + row_range.start as f32 * position_map.line_height - scroll_top; +// content_origin.y + row_range.start as f32 * position_map.line_height - scroll_top; // for (idx, row) in row_range.enumerate() { // let line_layout = &position_map.line_layouts[(row - start_row) as usize].line; // let start_x = if row == range.start.row() { -// content_origin.x() + line_layout.x_for_index(range.start.column() as usize) +// content_origin.x + line_layout.x_for_index(range.start.column() as usize) // - scroll_left // } else { -// content_origin.x() - scroll_left +// content_origin.x - scroll_left // }; // let end_x = if row == range.end.row() { -// content_origin.x() + line_layout.x_for_index(range.end.column() as usize) - scroll_left +// content_origin.x + line_layout.x_for_index(range.end.column() as usize) - scroll_left // } else { -// content_origin.x() + line_layout.width() + line_end_overshoot - scroll_left +// content_origin.x + line_layout.width() + line_end_overshoot - scroll_left // }; -// bounds.push(Bounds::from_points( -// vec2f(start_x, first_y + position_map.line_height * idx as f32), -// vec2f(end_x, first_y + position_map.line_height * (idx + 1) as f32), +// bounds.push(Bounds::::from_points( +// point(start_x, first_y + position_map.line_height * idx as f32), +// point(end_x, first_y + position_map.line_height * (idx + 1) as f32), // )) // } @@ -3250,7 +3714,7 @@ fn scale_horizontal_mouse_autoscroll_delta(delta: f32) -> f32 { // ]); // }); // element.layout( -// SizeConstraint::new(vec2f(500., 500.), vec2f(500., 500.)), +// SizeConstraint::new(point(500., 500.), point(500., 500.)), // editor, // cx, // ) @@ -3334,7 +3798,7 @@ fn scale_horizontal_mouse_autoscroll_delta(delta: f32) -> f32 { // ]); // }); // element.layout( -// SizeConstraint::new(vec2f(500., 500.), vec2f(500., 500.)), +// SizeConstraint::new(point(500., 500.), point(500., 500.)), // editor, // cx, // ) @@ -3380,7 +3844,7 @@ fn scale_horizontal_mouse_autoscroll_delta(delta: f32) -> f32 { // disposition: BlockDisposition::Above, // height: 3, // position: Anchor::min(), -// render: Arc::new(|_| Empty::new().into_any()), +// render: Arc::new(|_| Empty::new().into_any), // }], // None, // cx, @@ -3393,7 +3857,7 @@ fn scale_horizontal_mouse_autoscroll_delta(delta: f32) -> f32 { // let mut element = EditorElement::new(editor.read_with(cx, |editor, cx| editor.style(cx))); // let (size, mut state) = editor.update(cx, |editor, cx| { // element.layout( -// SizeConstraint::new(vec2f(500., 500.), vec2f(500., 500.)), +// SizeConstraint::new(point(500., 500.), point(500., 500.)), // editor, // cx, // ) @@ -3410,7 +3874,7 @@ fn scale_horizontal_mouse_autoscroll_delta(delta: f32) -> f32 { // ); // // Don't panic. -// let bounds = Bounds::new(Default::default(), size); +// let bounds = Bounds::::new(Default::default(), size); // editor.update(cx, |editor, cx| { // element.paint(bounds, bounds, &mut state, editor, cx); // }); @@ -3478,7 +3942,7 @@ fn scale_horizontal_mouse_autoscroll_delta(delta: f32) -> f32 { // "\t\t\t| | a b", // 500.0, // ); -// assert!(invisibles.is_empty(), +// assert!(invisibles.is_empty, // "For editor mode {editor_mode_without_invisibles:?} no invisibles was expected but got {invisibles:?}"); // } // } @@ -3551,7 +4015,7 @@ fn scale_horizontal_mouse_autoscroll_delta(delta: f32) -> f32 { // } // let missing_expected_invisibles = &expected_invisibles[i + 1..]; // assert!( -// missing_expected_invisibles.is_empty(), +// missing_expected_invisibles.is_empty, // "Missing expected invisibles after index {i}: {missing_expected_invisibles:?}" // ); @@ -3581,7 +4045,7 @@ fn scale_horizontal_mouse_autoscroll_delta(delta: f32) -> f32 { // editor.set_wrap_width(Some(editor_width), cx); // element.layout( -// SizeConstraint::new(vec2f(editor_width, 500.), vec2f(editor_width, 500.)), +// SizeConstraint::new(point(editor_width, 500.), point(editor_width, 500.)), // editor, // cx, // ) diff --git a/crates/editor2/src/items.rs b/crates/editor2/src/items.rs index a4d34ad36f218af6440ac8183d47c4afca1547df..e0b4423f82dec1cc3f732d40743f2e534a3f3477 100644 --- a/crates/editor2/src/items.rs +++ b/crates/editor2/src/items.rs @@ -159,16 +159,14 @@ impl FollowableItem for Editor { self.buffer.update(cx, |buffer, cx| { buffer.remove_active_selections(cx); }); - } else { + } else if self.focus_handle.is_focused(cx) { self.buffer.update(cx, |buffer, cx| { - if self.focused { - buffer.set_active_selections( - &self.selections.disjoint_anchors(), - self.selections.line_mode, - self.cursor_shape, - cx, - ); - } + buffer.set_active_selections( + &self.selections.disjoint_anchors(), + self.selections.line_mode, + self.cursor_shape, + cx, + ); }); } cx.notify(); diff --git a/crates/editor2/src/link_go_to_definition.rs b/crates/editor2/src/link_go_to_definition.rs index 8c285c8214c1948435daf7f81e1b38c073be4baa..9db4061e5096ac3f4b3a221a3bc22f45114b26d2 100644 --- a/crates/editor2/src/link_go_to_definition.rs +++ b/crates/editor2/src/link_go_to_definition.rs @@ -581,7 +581,7 @@ fn go_to_fetched_definition_of_kind( let is_correct_kind = cached_definitions_kind == Some(kind); if !cached_definitions.is_empty() && is_correct_kind { - if !editor.focused { + if !editor.focus_handle.is_focused(cx) { cx.focus(&editor.focus_handle); } diff --git a/crates/gpui2/src/app.rs b/crates/gpui2/src/app.rs index 9afffeb685a8c38ecd8a0aaf075ce6a2c4fbdf5e..801047de5fc857fd3a1bab0a89535febc5126c25 100644 --- a/crates/gpui2/src/app.rs +++ b/crates/gpui2/src/app.rs @@ -48,15 +48,15 @@ pub struct AppCell { impl AppCell { #[track_caller] pub fn borrow(&self) -> AppRef { - let thread_id = std::thread::current().id(); - eprintln!("borrowed {thread_id:?}"); + // let thread_id = std::thread::current().id(); + // eprintln!("borrowed {thread_id:?}"); AppRef(self.app.borrow()) } #[track_caller] pub fn borrow_mut(&self) -> AppRefMut { - let thread_id = std::thread::current().id(); - eprintln!("borrowed {thread_id:?}"); + // let thread_id = std::thread::current().id(); + // eprintln!("borrowed {thread_id:?}"); AppRefMut(self.app.borrow_mut()) } } diff --git a/crates/gpui2/src/color.rs b/crates/gpui2/src/color.rs index db072594760f160a303020af20021e05d74db300..77f8ebdf41cad82bd16a36380814d8bf1c946cd1 100644 --- a/crates/gpui2/src/color.rs +++ b/crates/gpui2/src/color.rs @@ -176,6 +176,15 @@ pub fn black() -> Hsla { } } +pub fn transparent_black() -> Hsla { + Hsla { + h: 0., + s: 0., + l: 0., + a: 0., + } +} + pub fn white() -> Hsla { Hsla { h: 0., diff --git a/crates/gpui2/src/elements/text.rs b/crates/gpui2/src/elements/text.rs index 4bc37054902653a85f931d82354183edc9142fe3..76c587d22f3e641c248f38e79a96b2651aa7ab43 100644 --- a/crates/gpui2/src/elements/text.rs +++ b/crates/gpui2/src/elements/text.rs @@ -74,7 +74,7 @@ impl Element for Text { ) -> LayoutId { let text_system = cx.text_system().clone(); let text_style = cx.text_style(); - let font_size = text_style.font_size * cx.rem_size(); + let font_size = text_style.font_size.to_pixels(cx.rem_size()); let line_height = text_style .line_height .to_pixels(font_size.into(), cx.rem_size()); diff --git a/crates/gpui2/src/geometry.rs b/crates/gpui2/src/geometry.rs index d6755a53973f00d5fee4fd11912f6e73da26cf71..e26e6e2eccf0bbecc3813977cdc60dea35d5a20f 100644 --- a/crates/gpui2/src/geometry.rs +++ b/crates/gpui2/src/geometry.rs @@ -492,6 +492,15 @@ where impl Copy for Edges {} impl Edges { + pub fn all(value: T) -> Self { + Self { + top: value.clone(), + right: value.clone(), + bottom: value.clone(), + left: value, + } + } + pub fn map(&self, f: impl Fn(&T) -> U) -> Edges where U: Clone + Default + Debug, @@ -730,6 +739,7 @@ impl MulAssign for Pixels { } impl Pixels { + pub const ZERO: Pixels = Pixels(0.0); pub const MAX: Pixels = Pixels(f32::MAX); pub fn as_usize(&self) -> usize { diff --git a/crates/gpui2/src/style.rs b/crates/gpui2/src/style.rs index d2571a3253522cbfed12ffce1d130d762ac59a5a..551a87624cad716e1073f3bf16366d5a6c705027 100644 --- a/crates/gpui2/src/style.rs +++ b/crates/gpui2/src/style.rs @@ -1,8 +1,8 @@ use crate::{ black, phi, point, rems, AbsoluteLength, BorrowAppContext, BorrowWindow, Bounds, ContentMask, 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; @@ -134,7 +134,7 @@ pub struct TextStyle { pub color: Hsla, pub font_family: SharedString, pub font_features: FontFeatures, - pub font_size: Rems, + pub font_size: AbsoluteLength, pub line_height: DefiniteLength, pub font_weight: FontWeight, pub font_style: FontStyle, @@ -147,7 +147,7 @@ impl Default for TextStyle { color: black(), font_family: "Helvetica".into(), // todo!("Get a font we know exists on the system") font_features: FontFeatures::default(), - font_size: rems(1.), + font_size: rems(1.).into(), line_height: phi(), font_weight: FontWeight::default(), font_style: FontStyle::default(), diff --git a/crates/gpui2/src/styled.rs b/crates/gpui2/src/styled.rs index a272ab95b14d7416e91d0bf166f2683e7941f02e..06be0368c02e88792e409e8675ba9c9c0aebedc8 100644 --- a/crates/gpui2/src/styled.rs +++ b/crates/gpui2/src/styled.rs @@ -1,7 +1,7 @@ use crate::{ - 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; @@ -433,7 +433,7 @@ pub trait Styled { self } - fn text_size(mut self, size: impl Into) -> Self + fn text_size(mut self, size: impl Into) -> Self where Self: Sized, { @@ -449,7 +449,7 @@ pub trait Styled { { self.text_style() .get_or_insert_with(Default::default) - .font_size = Some(rems(0.75)); + .font_size = Some(rems(0.75).into()); self } @@ -459,7 +459,7 @@ pub trait Styled { { self.text_style() .get_or_insert_with(Default::default) - .font_size = Some(rems(0.875)); + .font_size = Some(rems(0.875).into()); self } @@ -469,7 +469,7 @@ pub trait Styled { { self.text_style() .get_or_insert_with(Default::default) - .font_size = Some(rems(1.0)); + .font_size = Some(rems(1.0).into()); self } @@ -479,7 +479,7 @@ pub trait Styled { { self.text_style() .get_or_insert_with(Default::default) - .font_size = Some(rems(1.125)); + .font_size = Some(rems(1.125).into()); self } @@ -489,7 +489,7 @@ pub trait Styled { { self.text_style() .get_or_insert_with(Default::default) - .font_size = Some(rems(1.25)); + .font_size = Some(rems(1.25).into()); self } @@ -499,7 +499,7 @@ pub trait Styled { { self.text_style() .get_or_insert_with(Default::default) - .font_size = Some(rems(1.5)); + .font_size = Some(rems(1.5).into()); self } @@ -509,7 +509,7 @@ pub trait Styled { { self.text_style() .get_or_insert_with(Default::default) - .font_size = Some(rems(1.875)); + .font_size = Some(rems(1.875).into()); self } diff --git a/crates/gpui2/src/text_system/line.rs b/crates/gpui2/src/text_system/line.rs index 63aac96faff9be6f3a452ecf034f501952a4285f..ad70a79bb1e411fdaa4b0fddc0de39bdbf96e7af 100644 --- a/crates/gpui2/src/text_system/line.rs +++ b/crates/gpui2/src/text_system/line.rs @@ -29,10 +29,6 @@ impl Line { ) } - pub fn width(&self) -> Pixels { - self.layout.width - } - pub fn wrap_count(&self) -> usize { self.layout.wrap_boundaries.len() } diff --git a/crates/gpui2/src/text_system/line_layout.rs b/crates/gpui2/src/text_system/line_layout.rs index a310c32cd1f369ed5d6ef3e579ef45c1fdd0d4be..1b5e28c95836518da5ddbb16262a295ae698a2ff 100644 --- a/crates/gpui2/src/text_system/line_layout.rs +++ b/crates/gpui2/src/text_system/line_layout.rs @@ -82,18 +82,6 @@ impl LineLayout { self.width } - pub fn font_for_index(&self, index: usize) -> Option { - for run in &self.runs { - for glyph in &run.glyphs { - if glyph.index >= index { - return Some(run.font_id); - } - } - } - - None - } - fn compute_wrap_boundaries( &self, text: &str, diff --git a/crates/theme2/src/colors.rs b/crates/theme2/src/colors.rs index 1a1fd2e99ec5f568b06cec93cbdb86ea8ae91296..e1df841c24b8cce7c43296dbb569d82b9fb5277f 100644 --- a/crates/theme2/src/colors.rs +++ b/crates/theme2/src/colors.rs @@ -21,6 +21,23 @@ pub struct PlayerColor { #[derive(Clone)] pub struct PlayerColors(pub Vec); +impl PlayerColors { + pub fn local(&self) -> PlayerColor { + // todo!("use a valid color"); + *self.0.first().unwrap() + } + + pub fn absent(&self) -> PlayerColor { + // todo!("use a valid color"); + *self.0.last().unwrap() + } + + pub fn color_for_participant(&self, participant_index: u32) -> PlayerColor { + let len = self.0.len() - 1; + self.0[(participant_index as usize % len) + 1] + } +} + #[derive(Refineable, Clone, Debug)] #[refineable(debug)] pub struct StatusColors { @@ -89,8 +106,17 @@ pub struct ThemeColors { 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 editor_document_highlight_read_background: Hsla, + pub editor_document_highlight_write_background: Hsla, pub terminal_background: Hsla, pub terminal_ansi_bright_black: Hsla, pub terminal_ansi_bright_red: Hsla, diff --git a/crates/theme2/src/default_colors.rs b/crates/theme2/src/default_colors.rs index 53e34acf1608003d20760ee750e6d449fbd11b43..f79518e7696894bc31f9149201446d4c64d53c08 100644 --- a/crates/theme2/src/default_colors.rs +++ b/crates/theme2/src/default_colors.rs @@ -59,24 +59,24 @@ impl Default for PlayerColors { fn default() -> Self { Self(vec![ PlayerColor { - cursor: hsla(0.0, 0.0, 0.0, 0.0), - background: hsla(0.0, 0.0, 0.0, 0.0), - selection: hsla(0.0, 0.0, 0.0, 0.0), + cursor: hsla(0.0, 0.0, 0.0, 1.0), + background: hsla(0.0, 0.0, 0.0, 1.0), + selection: hsla(0.0, 0.0, 0.0, 1.0), }, PlayerColor { - cursor: hsla(0.0, 0.0, 0.0, 0.0), - background: hsla(0.0, 0.0, 0.0, 0.0), - selection: hsla(0.0, 0.0, 0.0, 0.0), + cursor: hsla(0.0, 0.0, 0.0, 1.0), + background: hsla(0.0, 0.0, 0.0, 1.0), + selection: hsla(0.0, 0.0, 0.0, 1.0), }, PlayerColor { - cursor: hsla(0.0, 0.0, 0.0, 0.0), - background: hsla(0.0, 0.0, 0.0, 0.0), - selection: hsla(0.0, 0.0, 0.0, 0.0), + cursor: hsla(0.0, 0.0, 0.0, 1.0), + background: hsla(0.0, 0.0, 0.0, 1.0), + selection: hsla(0.0, 0.0, 0.0, 1.0), }, PlayerColor { - cursor: hsla(0.0, 0.0, 0.0, 0.0), - background: hsla(0.0, 0.0, 0.0, 0.0), - selection: hsla(0.0, 0.0, 0.0, 0.0), + cursor: hsla(0.0, 0.0, 0.0, 1.0), + background: hsla(0.0, 0.0, 0.0, 1.0), + selection: hsla(0.0, 0.0, 0.0, 1.0), }, ]) } @@ -240,8 +240,17 @@ impl ThemeColors { 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_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") + editor_document_highlight_read_background: neutral().light_alpha().step_4(), // todo!("pick the right colors") + editor_document_highlight_write_background: 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(), @@ -304,8 +313,17 @@ impl ThemeColors { 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_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") + editor_document_highlight_read_background: neutral().dark_alpha().step_4(), // todo!("pick the right colors") + editor_document_highlight_write_background: 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(), diff --git a/crates/theme2/src/registry.rs b/crates/theme2/src/registry.rs index bc6f8dbe945a2c137409b5bfddd1d796a65b3616..98797e2cad573d1c11ae4d2e0c8a6baadcf475fb 100644 --- a/crates/theme2/src/registry.rs +++ b/crates/theme2/src/registry.rs @@ -1,4 +1,4 @@ -use crate::{all_imported_themes, zed_pro_family, ThemeFamily, ThemeVariant}; +use crate::{zed_pro_family, ThemeFamily, ThemeVariant}; use anyhow::{anyhow, Result}; use gpui::SharedString; use std::{collections::HashMap, sync::Arc}; @@ -42,10 +42,8 @@ impl Default for ThemeRegistry { themes: HashMap::default(), }; - let mut all_themes = vec![zed_pro_family()]; - all_themes.extend(all_imported_themes()); - - this.insert_theme_families(all_themes); + this.insert_theme_families([zed_pro_family()]); + this.insert_theme_families(crate::all_imported_themes()); this } diff --git a/crates/theme2/src/theme2.rs b/crates/theme2/src/theme2.rs index bbeea1817f60f67aeddd4c9488f9da3b3834647a..40e782c61790ba90c9b4d12ae731e3a0de570dbd 100644 --- a/crates/theme2/src/theme2.rs +++ b/crates/theme2/src/theme2.rs @@ -7,6 +7,8 @@ mod settings; mod syntax; mod themes; +use std::sync::Arc; + use ::settings::Settings; pub use colors::*; pub use default_colors::*; @@ -31,11 +33,11 @@ pub fn init(cx: &mut AppContext) { } pub trait ActiveTheme { - fn theme(&self) -> &ThemeVariant; + fn theme(&self) -> &Arc; } impl ActiveTheme for AppContext { - fn theme(&self) -> &ThemeVariant { + fn theme(&self) -> &Arc { &ThemeSettings::get_global(self).active_theme } } @@ -58,6 +60,12 @@ pub struct ThemeVariant { } impl ThemeVariant { + /// Returns the [`ThemeColors`] for the theme. + #[inline(always)] + pub fn players(&self) -> &PlayerColors { + &self.styles.player + } + /// Returns the [`ThemeColors`] for the theme. #[inline(always)] pub fn colors(&self) -> &ThemeColors { diff --git a/crates/theme2/src/themes/andromeda.rs b/crates/theme2/src/themes/andromeda.rs index 46e14a99ad2d0044467a434382b0ccd43881ff12..b0400a8c4b584999b07ce6965c0f1fa5b5c1b395 100644 --- a/crates/theme2/src/themes/andromeda.rs +++ b/crates/theme2/src/themes/andromeda.rs @@ -7,12 +7,12 @@ use crate::{ pub fn andromeda() -> ThemeFamily { ThemeFamily { - id: "192bb9a2-a028-4c9a-b713-4c92330b3fab".into(), + id: "ecd46547-a042-424d-99ca-5f56c060f798".into(), name: "Andromeda".into(), author: "Eliver Lara (EliverLara)".into(), themes: vec![ ThemeVariant { - id: "a3aaa73f-f225-41bd-8d52-77ca1df0b7f7".into(), + id: "3bfb3b6e-365a-4cd2-9a80-2d2c81434729".into(), name: "Andromeda".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -26,9 +26,9 @@ pub fn andromeda() -> ThemeFamily { border: rgba(0x1b1d23ff).into(), border_variant: rgba(0x1b1d23ff).into(), border_focused: rgba(0x1b1d23ff).into(), - border_disabled: rgba(0x1b1d23ff).into(), border_selected: rgba(0x1b1d23ff).into(), border_transparent: rgba(0x1b1d23ff).into(), + border_disabled: rgba(0x1b1d23ff).into(), elevated_surface_background: rgba(0x23262eff).into(), surface_background: rgba(0x23262eff).into(), background: rgba(0x23262eff).into(), @@ -61,8 +61,17 @@ pub fn andromeda() -> ThemeFamily { tab_inactive_background: rgba(0x23262eff).into(), tab_active_background: rgba(0x23262eff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x111113ff).into(), terminal_ansi_bright_black: rgba(0x000000e6).into(), terminal_ansi_bright_red: rgba(0xee5d42ff).into(), @@ -104,24 +113,24 @@ pub fn andromeda() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -170,7 +179,7 @@ pub fn andromeda() -> ThemeFamily { }, }, ThemeVariant { - id: "91a17b19-1e74-487e-b0a0-56e2e5360ab8".into(), + id: "7bc92ac8-152c-46d5-b346-df68e4db2e7c".into(), name: "Andromeda Bordered".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -184,9 +193,9 @@ pub fn andromeda() -> ThemeFamily { border: rgba(0x1b1d23ff).into(), border_variant: rgba(0x1b1d23ff).into(), border_focused: rgba(0x1b1d23ff).into(), - border_disabled: rgba(0x1b1d23ff).into(), border_selected: rgba(0x1b1d23ff).into(), border_transparent: rgba(0x1b1d23ff).into(), + border_disabled: rgba(0x1b1d23ff).into(), elevated_surface_background: rgba(0x23262eff).into(), surface_background: rgba(0x23262eff).into(), background: rgba(0x262933ff).into(), @@ -219,8 +228,17 @@ pub fn andromeda() -> ThemeFamily { tab_inactive_background: rgba(0x23262eff).into(), tab_active_background: rgba(0x262933ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x111113ff).into(), terminal_ansi_bright_black: rgba(0x000000e6).into(), terminal_ansi_bright_red: rgba(0xee5d42ff).into(), @@ -262,24 +280,24 @@ pub fn andromeda() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme2/src/themes/ayu.rs b/crates/theme2/src/themes/ayu.rs index 40fdb7ac15ba69c7efb76857dfe8298691860ecd..a2c054ac28db9f717b6ebba9df8518560d1b28fc 100644 --- a/crates/theme2/src/themes/ayu.rs +++ b/crates/theme2/src/themes/ayu.rs @@ -7,12 +7,12 @@ use crate::{ pub fn ayu() -> ThemeFamily { ThemeFamily { - id: "5ace5bd5-0231-4f26-a69f-40a96dd4163e".into(), + id: "4faecf44-837e-4034-9197-7da909668498".into(), name: "Ayu".into(), author: "dempfi (Ike Ku)".into(), themes: vec![ ThemeVariant { - id: "7781d65c-4575-421d-af3c-061ab0b0478a".into(), + id: "733aeb9b-98fd-4492-984e-d71540daf72e".into(), name: "Ayu Light".into(), appearance: Appearance::Light, styles: ThemeStyles { @@ -26,9 +26,9 @@ pub fn ayu() -> ThemeFamily { border: rgba(0x6b7d8f1f).into(), border_variant: rgba(0x6b7d8f1f).into(), border_focused: rgba(0x6b7d8f1f).into(), - border_disabled: rgba(0x6b7d8f1f).into(), border_selected: rgba(0x6b7d8f1f).into(), border_transparent: rgba(0x6b7d8f1f).into(), + border_disabled: rgba(0x6b7d8f1f).into(), elevated_surface_background: rgba(0xf8f9faff).into(), surface_background: rgba(0xf8f9faff).into(), background: rgba(0xf8f9faff).into(), @@ -61,8 +61,17 @@ pub fn ayu() -> ThemeFamily { tab_inactive_background: rgba(0xf8f9faff).into(), tab_active_background: rgba(0xf8f9faff).into(), editor_background: rgba(0xfcfcfdff).into(), + editor_gutter_background: rgba(0xfcfcfdff).into(), editor_subheader_background: rgba(0xf9f9fbff).into(), - editor_active_line: rgba(0x0000320f).into(), + editor_active_line_background: rgba(0x0000320f).into(), + editor_highlighted_line_background: rgba(0x00002c17).into(), + editor_line_number: rgba(0x0000320f).into(), + editor_active_line_number: rgba(0x0000320f).into(), + editor_invisible: rgba(0x00002c17).into(), + editor_wrap_guide: rgba(0x00002c17).into(), + editor_active_wrap_guide: rgba(0x00002c17).into(), + editor_document_highlight_read_background: rgba(0x00002c17).into(), + editor_document_highlight_write_background: rgba(0x00002c17).into(), terminal_background: rgba(0xf8f9faff).into(), terminal_ansi_bright_black: rgba(0x686868ff).into(), terminal_ansi_bright_red: rgba(0xef7070ff).into(), @@ -104,24 +113,24 @@ pub fn ayu() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -170,7 +179,7 @@ pub fn ayu() -> ThemeFamily { }, }, ThemeVariant { - id: "68066666-5e56-4937-9434-510ffd0fe05f".into(), + id: "50f68427-2e1d-4bf1-981a-d08c6b38e846".into(), name: "Ayu Mirage".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -184,9 +193,9 @@ pub fn ayu() -> ThemeFamily { border: rgba(0x171a24ff).into(), border_variant: rgba(0x171a24ff).into(), border_focused: rgba(0x171a24ff).into(), - border_disabled: rgba(0x171a24ff).into(), border_selected: rgba(0x171a24ff).into(), border_transparent: rgba(0x171a24ff).into(), + border_disabled: rgba(0x171a24ff).into(), elevated_surface_background: rgba(0x1f2430ff).into(), surface_background: rgba(0x1f2430ff).into(), background: rgba(0x1f2430ff).into(), @@ -219,8 +228,17 @@ pub fn ayu() -> ThemeFamily { tab_inactive_background: rgba(0x1f2430ff).into(), tab_active_background: rgba(0x1f2430ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x1f2430ff).into(), terminal_ansi_bright_black: rgba(0x686868ff).into(), terminal_ansi_bright_red: rgba(0xf18678ff).into(), @@ -262,24 +280,24 @@ pub fn ayu() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -328,7 +346,7 @@ pub fn ayu() -> ThemeFamily { }, }, ThemeVariant { - id: "d4f949b8-e5b9-4337-a52e-2ed1752a6c4f".into(), + id: "22d8dede-57da-46e1-946a-16876679b4d2".into(), name: "Ayu Dark".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -342,9 +360,9 @@ pub fn ayu() -> ThemeFamily { border: rgba(0x1e232bff).into(), border_variant: rgba(0x1e232bff).into(), border_focused: rgba(0x1e232bff).into(), - border_disabled: rgba(0x1e232bff).into(), border_selected: rgba(0x1e232bff).into(), border_transparent: rgba(0x1e232bff).into(), + border_disabled: rgba(0x1e232bff).into(), elevated_surface_background: rgba(0x0b0e14ff).into(), surface_background: rgba(0x0b0e14ff).into(), background: rgba(0x0b0e14ff).into(), @@ -377,8 +395,17 @@ pub fn ayu() -> ThemeFamily { tab_inactive_background: rgba(0x0b0e14ff).into(), tab_active_background: rgba(0x0b0e14ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x0b0e14ff).into(), terminal_ansi_bright_black: rgba(0x686868ff).into(), terminal_ansi_bright_red: rgba(0xef7077ff).into(), @@ -420,24 +447,24 @@ pub fn ayu() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme2/src/themes/dracula.rs b/crates/theme2/src/themes/dracula.rs index 2fae1b04f6ba0ceaeae2819c730da928ac051a87..7318057c53aef8d098621f7520ee0e8e2e4cf578 100644 --- a/crates/theme2/src/themes/dracula.rs +++ b/crates/theme2/src/themes/dracula.rs @@ -7,11 +7,11 @@ use crate::{ pub fn dracula() -> ThemeFamily { ThemeFamily { - id: "20b9a8c0-0b74-483b-bed2-be7a053e1321".into(), + id: "0abb0e55-f034-45d9-a84d-e880dfd65711".into(), name: "Dracula".into(), author: "Zeno Rocha".into(), themes: vec![ThemeVariant { - id: "02f5624f-9b0a-48e0-8897-4557adc8f104".into(), + id: "d20497ef-85be-4ea2-9070-a182d03aac73".into(), name: "Dracula".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -25,9 +25,9 @@ pub fn dracula() -> ThemeFamily { border: rgba(0xbd93f9ff).into(), border_variant: rgba(0xbd93f9ff).into(), border_focused: rgba(0xbd93f9ff).into(), - border_disabled: rgba(0xbd93f9ff).into(), border_selected: rgba(0xbd93f9ff).into(), border_transparent: rgba(0xbd93f9ff).into(), + border_disabled: rgba(0xbd93f9ff).into(), elevated_surface_background: rgba(0x282a35ff).into(), surface_background: rgba(0x282a35ff).into(), background: rgba(0x282a35ff).into(), @@ -60,8 +60,17 @@ pub fn dracula() -> ThemeFamily { tab_inactive_background: rgba(0x21222cff).into(), tab_active_background: rgba(0x282a35ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x282a35ff).into(), terminal_ansi_bright_black: rgba(0x6272a4ff).into(), terminal_ansi_bright_red: rgba(0xff6d6dff).into(), @@ -103,24 +112,24 @@ pub fn dracula() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme2/src/themes/gruvbox.rs b/crates/theme2/src/themes/gruvbox.rs index db5849718771d836cccd3f0230937b2e15176696..756a0b658be61dfaec2241dc3ce103f5a1d27082 100644 --- a/crates/theme2/src/themes/gruvbox.rs +++ b/crates/theme2/src/themes/gruvbox.rs @@ -7,12 +7,12 @@ use crate::{ pub fn gruvbox() -> ThemeFamily { ThemeFamily { - id: "c0b7f0e7-f261-4a33-a2bf-baf2e140aac4".into(), + id: "000a3e50-ccf1-430d-84e4-910583bd1064".into(), name: "Gruvbox".into(), author: "morhetz".into(), themes: vec![ ThemeVariant { - id: "fb9f8f64-372b-4fda-8dbd-d610c97a9691".into(), + id: "0db938b2-2267-453b-af84-f82c5f3400e7".into(), name: "Gruvbox Dark Hard".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -26,9 +26,9 @@ pub fn gruvbox() -> ThemeFamily { border: rgba(0x3c3836ff).into(), border_variant: rgba(0x3c3836ff).into(), border_focused: rgba(0x3c3836ff).into(), - border_disabled: rgba(0x3c3836ff).into(), border_selected: rgba(0x3c3836ff).into(), border_transparent: rgba(0x3c3836ff).into(), + border_disabled: rgba(0x3c3836ff).into(), elevated_surface_background: rgba(0x18191bff).into(), surface_background: rgba(0x18191bff).into(), background: rgba(0x1d2021ff).into(), @@ -61,8 +61,17 @@ pub fn gruvbox() -> ThemeFamily { tab_inactive_background: rgba(0x1d2021ff).into(), tab_active_background: rgba(0x32302fff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x1d2021ff).into(), terminal_ansi_bright_black: rgba(0x928374ff).into(), terminal_ansi_bright_red: rgba(0xfb4833ff).into(), @@ -104,24 +113,24 @@ pub fn gruvbox() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -170,7 +179,7 @@ pub fn gruvbox() -> ThemeFamily { }, }, ThemeVariant { - id: "72f0ea45-33bc-49d8-9f52-87540f858fb4".into(), + id: "8e1a1896-ed0f-40be-b127-6c389eacc9f1".into(), name: "Gruvbox Dark Medium".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -184,9 +193,9 @@ pub fn gruvbox() -> ThemeFamily { border: rgba(0x3c3836ff).into(), border_variant: rgba(0x3c3836ff).into(), border_focused: rgba(0x3c3836ff).into(), - border_disabled: rgba(0x3c3836ff).into(), border_selected: rgba(0x3c3836ff).into(), border_transparent: rgba(0x3c3836ff).into(), + border_disabled: rgba(0x3c3836ff).into(), elevated_surface_background: rgba(0x18191bff).into(), surface_background: rgba(0x18191bff).into(), background: rgba(0x282828ff).into(), @@ -219,8 +228,17 @@ pub fn gruvbox() -> ThemeFamily { tab_inactive_background: rgba(0x282828ff).into(), tab_active_background: rgba(0x3c3836ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x282828ff).into(), terminal_ansi_bright_black: rgba(0x928374ff).into(), terminal_ansi_bright_red: rgba(0xfb4833ff).into(), @@ -262,24 +280,24 @@ pub fn gruvbox() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -328,7 +346,7 @@ pub fn gruvbox() -> ThemeFamily { }, }, ThemeVariant { - id: "5ea1cdf8-6ed0-4e54-b44a-14c6634701cf".into(), + id: "94410e6f-f4c4-4669-bb4d-5a20b4e4b1f3".into(), name: "Gruvbox Dark Soft".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -342,9 +360,9 @@ pub fn gruvbox() -> ThemeFamily { border: rgba(0x3c3836ff).into(), border_variant: rgba(0x3c3836ff).into(), border_focused: rgba(0x3c3836ff).into(), - border_disabled: rgba(0x3c3836ff).into(), border_selected: rgba(0x3c3836ff).into(), border_transparent: rgba(0x3c3836ff).into(), + border_disabled: rgba(0x3c3836ff).into(), elevated_surface_background: rgba(0x18191bff).into(), surface_background: rgba(0x18191bff).into(), background: rgba(0x32302fff).into(), @@ -377,8 +395,17 @@ pub fn gruvbox() -> ThemeFamily { tab_inactive_background: rgba(0x32302fff).into(), tab_active_background: rgba(0x504945ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x32302fff).into(), terminal_ansi_bright_black: rgba(0x928374ff).into(), terminal_ansi_bright_red: rgba(0xfb4833ff).into(), @@ -420,24 +447,24 @@ pub fn gruvbox() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -486,7 +513,7 @@ pub fn gruvbox() -> ThemeFamily { }, }, ThemeVariant { - id: "b0c9082f-00c8-4a02-a4de-9fd7af97c7f2".into(), + id: "e4a58582-478a-4934-ad73-135e23a0d66e".into(), name: "Gruvbox Light Hard".into(), appearance: Appearance::Light, styles: ThemeStyles { @@ -500,9 +527,9 @@ pub fn gruvbox() -> ThemeFamily { border: rgba(0xebdbb2ff).into(), border_variant: rgba(0xebdbb2ff).into(), border_focused: rgba(0xebdbb2ff).into(), - border_disabled: rgba(0xebdbb2ff).into(), border_selected: rgba(0xebdbb2ff).into(), border_transparent: rgba(0xebdbb2ff).into(), + border_disabled: rgba(0xebdbb2ff).into(), elevated_surface_background: rgba(0xf9f9fbff).into(), surface_background: rgba(0xf9f9fbff).into(), background: rgba(0xf9f5d7ff).into(), @@ -535,8 +562,17 @@ pub fn gruvbox() -> ThemeFamily { tab_inactive_background: rgba(0xf9f5d7ff).into(), tab_active_background: rgba(0xf2e5bcff).into(), editor_background: rgba(0xfcfcfdff).into(), + editor_gutter_background: rgba(0xfcfcfdff).into(), editor_subheader_background: rgba(0xf9f9fbff).into(), - editor_active_line: rgba(0x0000320f).into(), + editor_active_line_background: rgba(0x0000320f).into(), + editor_highlighted_line_background: rgba(0x00002c17).into(), + editor_line_number: rgba(0x0000320f).into(), + editor_active_line_number: rgba(0x0000320f).into(), + editor_invisible: rgba(0x00002c17).into(), + editor_wrap_guide: rgba(0x00002c17).into(), + editor_active_wrap_guide: rgba(0x00002c17).into(), + editor_document_highlight_read_background: rgba(0x00002c17).into(), + editor_document_highlight_write_background: rgba(0x00002c17).into(), terminal_background: rgba(0xf9f5d7ff).into(), terminal_ansi_bright_black: rgba(0x928374ff).into(), terminal_ansi_bright_red: rgba(0x9d0006ff).into(), @@ -578,24 +614,24 @@ pub fn gruvbox() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -644,7 +680,7 @@ pub fn gruvbox() -> ThemeFamily { }, }, ThemeVariant { - id: "172c281c-ff0a-496e-8794-880e2fc3aa49".into(), + id: "0e875280-93fa-4c76-8874-f858c7d985c1".into(), name: "Gruvbox Light Medium".into(), appearance: Appearance::Light, styles: ThemeStyles { @@ -658,9 +694,9 @@ pub fn gruvbox() -> ThemeFamily { border: rgba(0xebdbb2ff).into(), border_variant: rgba(0xebdbb2ff).into(), border_focused: rgba(0xebdbb2ff).into(), - border_disabled: rgba(0xebdbb2ff).into(), border_selected: rgba(0xebdbb2ff).into(), border_transparent: rgba(0xebdbb2ff).into(), + border_disabled: rgba(0xebdbb2ff).into(), elevated_surface_background: rgba(0xf9f9fbff).into(), surface_background: rgba(0xf9f9fbff).into(), background: rgba(0xfbf1c7ff).into(), @@ -693,8 +729,17 @@ pub fn gruvbox() -> ThemeFamily { tab_inactive_background: rgba(0xfbf1c7ff).into(), tab_active_background: rgba(0xebdbb2ff).into(), editor_background: rgba(0xfcfcfdff).into(), + editor_gutter_background: rgba(0xfcfcfdff).into(), editor_subheader_background: rgba(0xf9f9fbff).into(), - editor_active_line: rgba(0x0000320f).into(), + editor_active_line_background: rgba(0x0000320f).into(), + editor_highlighted_line_background: rgba(0x00002c17).into(), + editor_line_number: rgba(0x0000320f).into(), + editor_active_line_number: rgba(0x0000320f).into(), + editor_invisible: rgba(0x00002c17).into(), + editor_wrap_guide: rgba(0x00002c17).into(), + editor_active_wrap_guide: rgba(0x00002c17).into(), + editor_document_highlight_read_background: rgba(0x00002c17).into(), + editor_document_highlight_write_background: rgba(0x00002c17).into(), terminal_background: rgba(0xfbf1c7ff).into(), terminal_ansi_bright_black: rgba(0x928374ff).into(), terminal_ansi_bright_red: rgba(0x9d0006ff).into(), @@ -736,24 +781,24 @@ pub fn gruvbox() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -802,7 +847,7 @@ pub fn gruvbox() -> ThemeFamily { }, }, ThemeVariant { - id: "b94f3305-b755-44f2-948c-cfd8c9d3158f".into(), + id: "914dbe6f-bc0f-4e6f-8d8c-5f4cabc1ca2d".into(), name: "Gruvbox Light Soft".into(), appearance: Appearance::Light, styles: ThemeStyles { @@ -816,9 +861,9 @@ pub fn gruvbox() -> ThemeFamily { border: rgba(0xebdbb2ff).into(), border_variant: rgba(0xebdbb2ff).into(), border_focused: rgba(0xebdbb2ff).into(), - border_disabled: rgba(0xebdbb2ff).into(), border_selected: rgba(0xebdbb2ff).into(), border_transparent: rgba(0xebdbb2ff).into(), + border_disabled: rgba(0xebdbb2ff).into(), elevated_surface_background: rgba(0xf9f9fbff).into(), surface_background: rgba(0xf9f9fbff).into(), background: rgba(0xf2e5bcff).into(), @@ -851,8 +896,17 @@ pub fn gruvbox() -> ThemeFamily { tab_inactive_background: rgba(0xf2e5bcff).into(), tab_active_background: rgba(0xd5c4a1ff).into(), editor_background: rgba(0xfcfcfdff).into(), + editor_gutter_background: rgba(0xfcfcfdff).into(), editor_subheader_background: rgba(0xf9f9fbff).into(), - editor_active_line: rgba(0x0000320f).into(), + editor_active_line_background: rgba(0x0000320f).into(), + editor_highlighted_line_background: rgba(0x00002c17).into(), + editor_line_number: rgba(0x0000320f).into(), + editor_active_line_number: rgba(0x0000320f).into(), + editor_invisible: rgba(0x00002c17).into(), + editor_wrap_guide: rgba(0x00002c17).into(), + editor_active_wrap_guide: rgba(0x00002c17).into(), + editor_document_highlight_read_background: rgba(0x00002c17).into(), + editor_document_highlight_write_background: rgba(0x00002c17).into(), terminal_background: rgba(0xf2e5bcff).into(), terminal_ansi_bright_black: rgba(0x928374ff).into(), terminal_ansi_bright_red: rgba(0x9d0006ff).into(), @@ -894,24 +948,24 @@ pub fn gruvbox() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme2/src/themes/night_owl.rs b/crates/theme2/src/themes/night_owl.rs index d4418ac3dc7d72fc6df6c494e822b3a2071245aa..ed727127bdee22a1d3cd6162f0bbcfe58e331bb5 100644 --- a/crates/theme2/src/themes/night_owl.rs +++ b/crates/theme2/src/themes/night_owl.rs @@ -7,12 +7,12 @@ use crate::{ pub fn night_owl() -> ThemeFamily { ThemeFamily { - id: "b6469599-df68-4604-be9d-44f63d877d53".into(), + id: "19498197-1091-409d-b37a-a282998e5c31".into(), name: "Night Owl".into(), author: "Sarah Drasner (sdras)".into(), themes: vec![ ThemeVariant { - id: "2a04e5fa-e266-475b-b965-3d92efe77ad9".into(), + id: "e5de91ed-fc95-46fb-a60b-ebd0602d04c7".into(), name: "Night Owl".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -26,9 +26,9 @@ pub fn night_owl() -> ThemeFamily { border: rgba(0x5f7e97ff).into(), border_variant: rgba(0x5f7e97ff).into(), border_focused: rgba(0x5f7e97ff).into(), - border_disabled: rgba(0x5f7e97ff).into(), border_selected: rgba(0x5f7e97ff).into(), border_transparent: rgba(0x5f7e97ff).into(), + border_disabled: rgba(0x5f7e97ff).into(), elevated_surface_background: rgba(0x011526ff).into(), surface_background: rgba(0x011526ff).into(), background: rgba(0x011526ff).into(), @@ -61,8 +61,17 @@ pub fn night_owl() -> ThemeFamily { tab_inactive_background: rgba(0x01101cff).into(), tab_active_background: rgba(0x0a2842ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x111113ff).into(), terminal_ansi_bright_black: rgba(0x575656ff).into(), terminal_ansi_bright_red: rgba(0xef524fff).into(), @@ -104,24 +113,24 @@ pub fn night_owl() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -170,7 +179,7 @@ pub fn night_owl() -> ThemeFamily { }, }, ThemeVariant { - id: "91901d29-1c1f-49ef-ac69-c25639425f7c".into(), + id: "998fc053-40c1-4a32-a31f-a17c9c07949a".into(), name: "Night Owl Light".into(), appearance: Appearance::Light, styles: ThemeStyles { @@ -184,9 +193,9 @@ pub fn night_owl() -> ThemeFamily { border: rgba(0xd9d9d9ff).into(), border_variant: rgba(0xd9d9d9ff).into(), border_focused: rgba(0xd9d9d9ff).into(), - border_disabled: rgba(0xd9d9d9ff).into(), border_selected: rgba(0xd9d9d9ff).into(), border_transparent: rgba(0xd9d9d9ff).into(), + border_disabled: rgba(0xd9d9d9ff).into(), elevated_surface_background: rgba(0xf0f0f0ff).into(), surface_background: rgba(0xf0f0f0ff).into(), background: rgba(0xfbfbfbff).into(), @@ -219,8 +228,17 @@ pub fn night_owl() -> ThemeFamily { tab_inactive_background: rgba(0xf0f0f0ff).into(), tab_active_background: rgba(0xf6f6f6ff).into(), editor_background: rgba(0xfcfcfdff).into(), + editor_gutter_background: rgba(0xfcfcfdff).into(), editor_subheader_background: rgba(0xf9f9fbff).into(), - editor_active_line: rgba(0x0000320f).into(), + editor_active_line_background: rgba(0x0000320f).into(), + editor_highlighted_line_background: rgba(0x00002c17).into(), + editor_line_number: rgba(0x0000320f).into(), + editor_active_line_number: rgba(0x0000320f).into(), + editor_invisible: rgba(0x00002c17).into(), + editor_wrap_guide: rgba(0x00002c17).into(), + editor_active_wrap_guide: rgba(0x00002c17).into(), + editor_document_highlight_read_background: rgba(0x00002c17).into(), + editor_document_highlight_write_background: rgba(0x00002c17).into(), terminal_background: rgba(0xf6f6f6ff).into(), terminal_ansi_bright_black: rgba(0x403f53ff).into(), terminal_ansi_bright_red: rgba(0xde3c3aff).into(), @@ -262,24 +280,24 @@ pub fn night_owl() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme2/src/themes/nord.rs b/crates/theme2/src/themes/nord.rs index 953ee1d0da5617de5948e061bb316c34d47c8e0d..25e6da2c5e8440b9cbc5a3b4ce8d5d32f1184f3c 100644 --- a/crates/theme2/src/themes/nord.rs +++ b/crates/theme2/src/themes/nord.rs @@ -7,11 +7,11 @@ use crate::{ pub fn nord() -> ThemeFamily { ThemeFamily { - id: "dcd03133-f540-47e7-9360-91bb1c94d16e".into(), + id: "3295b94b-731f-41a8-8d5e-ad02638f8e0d".into(), name: "Nord".into(), author: "Sven Greb (svengreb)".into(), themes: vec![ThemeVariant { - id: "ed7e8c08-321a-41f0-bd22-ca92c0b42e0e".into(), + id: "dfdfd9f6-bc57-46dd-b919-42b18df35bdd".into(), name: "Nord".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -25,9 +25,9 @@ pub fn nord() -> ThemeFamily { border: rgba(0x3b4252ff).into(), border_variant: rgba(0x3b4252ff).into(), border_focused: rgba(0x3b4252ff).into(), - border_disabled: rgba(0x3b4252ff).into(), border_selected: rgba(0x3b4252ff).into(), border_transparent: rgba(0x3b4252ff).into(), + border_disabled: rgba(0x3b4252ff).into(), elevated_surface_background: rgba(0x2e3440ff).into(), surface_background: rgba(0x2e3440ff).into(), background: rgba(0x2e3440ff).into(), @@ -60,8 +60,17 @@ pub fn nord() -> ThemeFamily { tab_inactive_background: rgba(0x2e3440ff).into(), tab_active_background: rgba(0x3b4252ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x2e3440ff).into(), terminal_ansi_bright_black: rgba(0x4c566aff).into(), terminal_ansi_bright_red: rgba(0xbf616aff).into(), @@ -103,24 +112,24 @@ pub fn nord() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme2/src/themes/notctis.rs b/crates/theme2/src/themes/notctis.rs index d11463ea42ea278efd446540bf438c55203a3791..70c57bac57bd2cb9144bf33c32f07ba8a1cf2ac6 100644 --- a/crates/theme2/src/themes/notctis.rs +++ b/crates/theme2/src/themes/notctis.rs @@ -7,12 +7,12 @@ use crate::{ pub fn notctis() -> ThemeFamily { ThemeFamily { - id: "077650e4-c11f-4cb5-96ec-73bc74923e95".into(), + id: "7fbf6904-517c-42e1-8eb3-a64b1e9218b9".into(), name: "Notctis".into(), author: "Liviu Schera (liviuschera)".into(), themes: vec![ ThemeVariant { - id: "47135df9-e9b5-480c-a71b-c85052b8ff93".into(), + id: "2dc5fee8-30ff-4a50-bfae-c13bd19c9f89".into(), name: "Noctis Azureus".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -26,9 +26,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0x1579b6ff).into(), border_variant: rgba(0x1579b6ff).into(), border_focused: rgba(0x1579b6ff).into(), - border_disabled: rgba(0x1579b6ff).into(), border_selected: rgba(0x1579b6ff).into(), border_transparent: rgba(0x1579b6ff).into(), + border_disabled: rgba(0x1579b6ff).into(), elevated_surface_background: rgba(0x051b28ff).into(), surface_background: rgba(0x051b28ff).into(), background: rgba(0x07263aff).into(), @@ -61,8 +61,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0x08324eff).into(), tab_active_background: rgba(0x07263aff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x051b28ff).into(), terminal_ansi_bright_black: rgba(0x475e6cff).into(), terminal_ansi_bright_red: rgba(0xe97749ff).into(), @@ -104,24 +113,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -170,7 +179,7 @@ pub fn notctis() -> ThemeFamily { }, }, ThemeVariant { - id: "5a3842b1-2273-47ce-ab82-4179842362b1".into(), + id: "ba4f5a34-987a-4e2c-939c-7f1b02d0e432".into(), name: "Noctis Bordo".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -184,9 +193,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0x997582ff).into(), border_variant: rgba(0x997582ff).into(), border_focused: rgba(0x997582ff).into(), - border_disabled: rgba(0x997582ff).into(), border_selected: rgba(0x997582ff).into(), border_transparent: rgba(0x997582ff).into(), + border_disabled: rgba(0x997582ff).into(), elevated_surface_background: rgba(0x272022ff).into(), surface_background: rgba(0x272022ff).into(), background: rgba(0x322a2dff).into(), @@ -219,8 +228,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0x413036ff).into(), tab_active_background: rgba(0x322a2dff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x272022ff).into(), terminal_ansi_bright_black: rgba(0x69545bff).into(), terminal_ansi_bright_red: rgba(0xe97749ff).into(), @@ -262,24 +280,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -328,7 +346,7 @@ pub fn notctis() -> ThemeFamily { }, }, ThemeVariant { - id: "a83c02b3-23f3-496b-8644-57df3314601e".into(), + id: "a2e4f327-82e8-41c1-a66f-bc7f27419c2e".into(), name: "Noctus Hibernus".into(), appearance: Appearance::Light, styles: ThemeStyles { @@ -342,9 +360,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0x00c6e0ff).into(), border_variant: rgba(0x00c6e0ff).into(), border_focused: rgba(0x00c6e0ff).into(), - border_disabled: rgba(0x00c6e0ff).into(), border_selected: rgba(0x00c6e0ff).into(), border_transparent: rgba(0x00c6e0ff).into(), + border_disabled: rgba(0x00c6e0ff).into(), elevated_surface_background: rgba(0xe1eeefff).into(), surface_background: rgba(0xe1eeefff).into(), background: rgba(0xf4f6f6ff).into(), @@ -377,8 +395,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0xcaedf2ff).into(), tab_active_background: rgba(0xf4f6f6ff).into(), editor_background: rgba(0xfcfcfdff).into(), + editor_gutter_background: rgba(0xfcfcfdff).into(), editor_subheader_background: rgba(0xf9f9fbff).into(), - editor_active_line: rgba(0x0000320f).into(), + editor_active_line_background: rgba(0x0000320f).into(), + editor_highlighted_line_background: rgba(0x00002c17).into(), + editor_line_number: rgba(0x0000320f).into(), + editor_active_line_number: rgba(0x0000320f).into(), + editor_invisible: rgba(0x00002c17).into(), + editor_wrap_guide: rgba(0x00002c17).into(), + editor_active_wrap_guide: rgba(0x00002c17).into(), + editor_document_highlight_read_background: rgba(0x00002c17).into(), + editor_document_highlight_write_background: rgba(0x00002c17).into(), terminal_background: rgba(0xe1eeefff).into(), terminal_ansi_bright_black: rgba(0x004d57ff).into(), terminal_ansi_bright_red: rgba(0xff3f00ff).into(), @@ -420,24 +447,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -486,7 +513,7 @@ pub fn notctis() -> ThemeFamily { }, }, ThemeVariant { - id: "bda85aea-2260-455a-959a-c03b0a62b8f4".into(), + id: "2fde44fb-e5b2-4cc2-962f-f1c77a4eb12a".into(), name: "Noctis Lilac".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -500,9 +527,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0xaea4f4ff).into(), border_variant: rgba(0xaea4f4ff).into(), border_focused: rgba(0xaea4f4ff).into(), - border_disabled: rgba(0xaea4f4ff).into(), border_selected: rgba(0xaea4f4ff).into(), border_transparent: rgba(0xaea4f4ff).into(), + border_disabled: rgba(0xaea4f4ff).into(), elevated_surface_background: rgba(0xe9e7f3ff).into(), surface_background: rgba(0xe9e7f3ff).into(), background: rgba(0xf2f1f8ff).into(), @@ -535,8 +562,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0xe2dff6ff).into(), tab_active_background: rgba(0xf2f1f8ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0xe9e7f3ff).into(), terminal_ansi_bright_black: rgba(0x0f0080ff).into(), terminal_ansi_bright_red: rgba(0xff3f00ff).into(), @@ -578,24 +614,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -644,7 +680,7 @@ pub fn notctis() -> ThemeFamily { }, }, ThemeVariant { - id: "7720f487-6b09-4bb6-9add-272b030c013f".into(), + id: "2b89f218-c238-4905-9578-674d6995d2e0".into(), name: "Noctis Lux".into(), appearance: Appearance::Light, styles: ThemeStyles { @@ -658,9 +694,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0x00c6e0ff).into(), border_variant: rgba(0x00c6e0ff).into(), border_focused: rgba(0x00c6e0ff).into(), - border_disabled: rgba(0x00c6e0ff).into(), border_selected: rgba(0x00c6e0ff).into(), border_transparent: rgba(0x00c6e0ff).into(), + border_disabled: rgba(0x00c6e0ff).into(), elevated_surface_background: rgba(0xf6eddaff).into(), surface_background: rgba(0xf6eddaff).into(), background: rgba(0xfef8ecff).into(), @@ -693,8 +729,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0xf0e9d6ff).into(), tab_active_background: rgba(0xfef8ecff).into(), editor_background: rgba(0xfcfcfdff).into(), + editor_gutter_background: rgba(0xfcfcfdff).into(), editor_subheader_background: rgba(0xf9f9fbff).into(), - editor_active_line: rgba(0x0000320f).into(), + editor_active_line_background: rgba(0x0000320f).into(), + editor_highlighted_line_background: rgba(0x00002c17).into(), + editor_line_number: rgba(0x0000320f).into(), + editor_active_line_number: rgba(0x0000320f).into(), + editor_invisible: rgba(0x00002c17).into(), + editor_wrap_guide: rgba(0x00002c17).into(), + editor_active_wrap_guide: rgba(0x00002c17).into(), + editor_document_highlight_read_background: rgba(0x00002c17).into(), + editor_document_highlight_write_background: rgba(0x00002c17).into(), terminal_background: rgba(0xf6eddaff).into(), terminal_ansi_bright_black: rgba(0x004d57ff).into(), terminal_ansi_bright_red: rgba(0xff3f00ff).into(), @@ -736,24 +781,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -802,7 +847,7 @@ pub fn notctis() -> ThemeFamily { }, }, ThemeVariant { - id: "51dfe842-b4e2-4d95-a306-8e579a3bb51c".into(), + id: "f88e2cd7-2415-4118-a638-5cfd3132ecf8".into(), name: "Noctis Minimus".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -816,9 +861,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0x496c83ff).into(), border_variant: rgba(0x496c83ff).into(), border_focused: rgba(0x496c83ff).into(), - border_disabled: rgba(0x496c83ff).into(), border_selected: rgba(0x496c83ff).into(), border_transparent: rgba(0x496c83ff).into(), + border_disabled: rgba(0x496c83ff).into(), elevated_surface_background: rgba(0x0e1920ff).into(), surface_background: rgba(0x0e1920ff).into(), background: rgba(0x1b2932ff).into(), @@ -851,8 +896,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0x202d37ff).into(), tab_active_background: rgba(0x1b2932ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x0e1920ff).into(), terminal_ansi_bright_black: rgba(0x425866ff).into(), terminal_ansi_bright_red: rgba(0xca8468ff).into(), @@ -894,24 +948,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -960,7 +1014,7 @@ pub fn notctis() -> ThemeFamily { }, }, ThemeVariant { - id: "75a67a53-afbe-4073-a7c0-85a40b56c2cc".into(), + id: "c4d43fc2-6166-47b7-8c5c-dd24afd4b735".into(), name: "Noctis".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -974,9 +1028,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0x0d6571ff).into(), border_variant: rgba(0x0d6571ff).into(), border_focused: rgba(0x0d6571ff).into(), - border_disabled: rgba(0x0d6571ff).into(), border_selected: rgba(0x0d6571ff).into(), border_transparent: rgba(0x0d6571ff).into(), + border_disabled: rgba(0x0d6571ff).into(), elevated_surface_background: rgba(0x03181aff).into(), surface_background: rgba(0x03181aff).into(), background: rgba(0x052428ff).into(), @@ -1009,8 +1063,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0x052e32ff).into(), tab_active_background: rgba(0x052428ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x03181aff).into(), terminal_ansi_bright_black: rgba(0x47686cff).into(), terminal_ansi_bright_red: rgba(0xe97749ff).into(), @@ -1052,24 +1115,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -1118,7 +1181,7 @@ pub fn notctis() -> ThemeFamily { }, }, ThemeVariant { - id: "0202afff-5703-473b-b6b6-e86ac3a70718".into(), + id: "7253a515-c612-403c-89de-5b62dc5cbac7".into(), name: "Noctis Obscuro".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -1132,9 +1195,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0x0d6571ff).into(), border_variant: rgba(0x0d6571ff).into(), border_focused: rgba(0x0d6571ff).into(), - border_disabled: rgba(0x0d6571ff).into(), border_selected: rgba(0x0d6571ff).into(), border_transparent: rgba(0x0d6571ff).into(), + border_disabled: rgba(0x0d6571ff).into(), elevated_surface_background: rgba(0x020c0eff).into(), surface_background: rgba(0x020c0eff).into(), background: rgba(0x031316ff).into(), @@ -1167,8 +1230,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0x052e32ff).into(), tab_active_background: rgba(0x031316ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x020c0eff).into(), terminal_ansi_bright_black: rgba(0x47686cff).into(), terminal_ansi_bright_red: rgba(0xe97749ff).into(), @@ -1210,24 +1282,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -1276,7 +1348,7 @@ pub fn notctis() -> ThemeFamily { }, }, ThemeVariant { - id: "213fd750-27ad-4762-8891-08282ed316c7".into(), + id: "b0f2d7b8-ac5f-466f-9bbf-e7cac242149c".into(), name: "Noctis Sereno".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -1290,9 +1362,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0x0d6571ff).into(), border_variant: rgba(0x0d6571ff).into(), border_focused: rgba(0x0d6571ff).into(), - border_disabled: rgba(0x0d6571ff).into(), border_selected: rgba(0x0d6571ff).into(), border_transparent: rgba(0x0d6571ff).into(), + border_disabled: rgba(0x0d6571ff).into(), elevated_surface_background: rgba(0x020c0eff).into(), surface_background: rgba(0x020c0eff).into(), background: rgba(0x031316ff).into(), @@ -1325,8 +1397,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0x052e32ff).into(), tab_active_background: rgba(0x031316ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x020c0eff).into(), terminal_ansi_bright_black: rgba(0x47686cff).into(), terminal_ansi_bright_red: rgba(0xe97749ff).into(), @@ -1368,24 +1449,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -1434,7 +1515,7 @@ pub fn notctis() -> ThemeFamily { }, }, ThemeVariant { - id: "0cc2c841-1c01-40a7-8396-1234dd077ede".into(), + id: "331ce3fd-8faf-4a46-ad89-2c678abc4cd3".into(), name: "Noctis Uva".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -1448,9 +1529,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0x6d66a7ff).into(), border_variant: rgba(0x6d66a7ff).into(), border_focused: rgba(0x6d66a7ff).into(), - border_disabled: rgba(0x6d66a7ff).into(), border_selected: rgba(0x6d66a7ff).into(), border_transparent: rgba(0x6d66a7ff).into(), + border_disabled: rgba(0x6d66a7ff).into(), elevated_surface_background: rgba(0x1f1d30ff).into(), surface_background: rgba(0x1f1d30ff).into(), background: rgba(0x292640ff).into(), @@ -1483,8 +1564,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0x2f2c49ff).into(), tab_active_background: rgba(0x292640ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x1f1d30ff).into(), terminal_ansi_bright_black: rgba(0x504e65ff).into(), terminal_ansi_bright_red: rgba(0xe97749ff).into(), @@ -1526,24 +1616,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -1592,7 +1682,7 @@ pub fn notctis() -> ThemeFamily { }, }, ThemeVariant { - id: "090a97c7-ad25-4a35-96e6-2fce5e471e6b".into(), + id: "209964f1-6a61-4e40-a605-be245555c493".into(), name: "Noctis Viola".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -1606,9 +1696,9 @@ pub fn notctis() -> ThemeFamily { border: rgba(0x8666a7ff).into(), border_variant: rgba(0x8666a7ff).into(), border_focused: rgba(0x8666a7ff).into(), - border_disabled: rgba(0x8666a7ff).into(), border_selected: rgba(0x8666a7ff).into(), border_transparent: rgba(0x8666a7ff).into(), + border_disabled: rgba(0x8666a7ff).into(), elevated_surface_background: rgba(0x291d35ff).into(), surface_background: rgba(0x291d35ff).into(), background: rgba(0x30243dff).into(), @@ -1641,8 +1731,17 @@ pub fn notctis() -> ThemeFamily { tab_inactive_background: rgba(0x3d2e4dff).into(), tab_active_background: rgba(0x30243dff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x291d35ff).into(), terminal_ansi_bright_black: rgba(0x594e65ff).into(), terminal_ansi_bright_red: rgba(0xe97749ff).into(), @@ -1684,24 +1783,24 @@ pub fn notctis() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme2/src/themes/palenight.rs b/crates/theme2/src/themes/palenight.rs index 836ec680cdf349d563aa5745122947d6fab26b5a..8ad0a86eb86dd156d40fdeab8f114ee523d89917 100644 --- a/crates/theme2/src/themes/palenight.rs +++ b/crates/theme2/src/themes/palenight.rs @@ -7,12 +7,12 @@ use crate::{ pub fn palenight() -> ThemeFamily { ThemeFamily { - id: "3187cd2f-29da-4bde-9621-83016df3b393".into(), + id: "16313d66-dab6-468a-82f6-e69759fdd8cf".into(), name: "Palenight".into(), author: "Olaolu Olawuyi (whizkydee)".into(), themes: vec![ ThemeVariant { - id: "0eaa3098-3aa2-4b8e-b1df-92d9ebd9a0b8".into(), + id: "39fdf216-2c76-4b3d-b368-7c31f479d524".into(), name: "Palenight".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -26,9 +26,9 @@ pub fn palenight() -> ThemeFamily { border: rgba(0x282b3bff).into(), border_variant: rgba(0x282b3bff).into(), border_focused: rgba(0x282b3bff).into(), - border_disabled: rgba(0x282b3bff).into(), border_selected: rgba(0x282b3bff).into(), border_transparent: rgba(0x282b3bff).into(), + border_disabled: rgba(0x282b3bff).into(), elevated_surface_background: rgba(0x292c3eff).into(), surface_background: rgba(0x292c3eff).into(), background: rgba(0x292c3eff).into(), @@ -61,8 +61,17 @@ pub fn palenight() -> ThemeFamily { tab_inactive_background: rgba(0x31364aff).into(), tab_active_background: rgba(0x292c3eff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x111113ff).into(), terminal_ansi_bright_black: rgba(0x676e95ff).into(), terminal_ansi_bright_red: rgba(0xff5571ff).into(), @@ -104,24 +113,24 @@ pub fn palenight() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -170,7 +179,7 @@ pub fn palenight() -> ThemeFamily { }, }, ThemeVariant { - id: "b6a27c72-c5b1-431b-8bfe-29e33dbcb337".into(), + id: "5ff8120f-37e9-4ad3-8bd0-c3e449ff1aa1".into(), name: "Palenight Operator".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -184,9 +193,9 @@ pub fn palenight() -> ThemeFamily { border: rgba(0x282b3bff).into(), border_variant: rgba(0x282b3bff).into(), border_focused: rgba(0x282b3bff).into(), - border_disabled: rgba(0x282b3bff).into(), border_selected: rgba(0x282b3bff).into(), border_transparent: rgba(0x282b3bff).into(), + border_disabled: rgba(0x282b3bff).into(), elevated_surface_background: rgba(0x292c3eff).into(), surface_background: rgba(0x292c3eff).into(), background: rgba(0x292c3eff).into(), @@ -219,8 +228,17 @@ pub fn palenight() -> ThemeFamily { tab_inactive_background: rgba(0x31364aff).into(), tab_active_background: rgba(0x292c3eff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x111113ff).into(), terminal_ansi_bright_black: rgba(0x676e95ff).into(), terminal_ansi_bright_red: rgba(0xff5571ff).into(), @@ -262,24 +280,24 @@ pub fn palenight() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -328,7 +346,7 @@ pub fn palenight() -> ThemeFamily { }, }, ThemeVariant { - id: "4015bf85-061c-45ff-81ba-a31f017aac83".into(), + id: "cff26efb-72f8-4496-b33b-991080a47f1c".into(), name: "Palenight (Mild Contrast)".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -342,9 +360,9 @@ pub fn palenight() -> ThemeFamily { border: rgba(0x2c2f40ff).into(), border_variant: rgba(0x2c2f40ff).into(), border_focused: rgba(0x2c2f40ff).into(), - border_disabled: rgba(0x2c2f40ff).into(), border_selected: rgba(0x2c2f40ff).into(), border_transparent: rgba(0x2c2f40ff).into(), + border_disabled: rgba(0x2c2f40ff).into(), elevated_surface_background: rgba(0x25283aff).into(), surface_background: rgba(0x25283aff).into(), background: rgba(0x292c3eff).into(), @@ -377,8 +395,17 @@ pub fn palenight() -> ThemeFamily { tab_inactive_background: rgba(0x31364aff).into(), tab_active_background: rgba(0x25283aff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x111113ff).into(), terminal_ansi_bright_black: rgba(0x676e95ff).into(), terminal_ansi_bright_red: rgba(0xff5571ff).into(), @@ -420,24 +447,24 @@ pub fn palenight() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme2/src/themes/rose_pine.rs b/crates/theme2/src/themes/rose_pine.rs index b367d6196b347c2e7dfe5a05e410262a4ae84310..d022d645cf3798259877d648021446bc3cdb9d9c 100644 --- a/crates/theme2/src/themes/rose_pine.rs +++ b/crates/theme2/src/themes/rose_pine.rs @@ -7,12 +7,12 @@ use crate::{ pub fn rose_pine() -> ThemeFamily { ThemeFamily { - id: "48c308b9-7dbe-4a52-b935-0b44d9dac00d".into(), + id: "9cf70eba-1185-4f3e-adb7-74f61c45c9dc".into(), name: "Rose Pine".into(), author: "Rosé Pine".into(), themes: vec![ ThemeVariant { - id: "c2832e85-20cb-4a13-924f-026e68123068".into(), + id: "80a8f5dd-2ab5-4ee7-9b25-a60c8513234e".into(), name: "Rose Pine".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -26,9 +26,9 @@ pub fn rose_pine() -> ThemeFamily { border: rgba(0x000000ff).into(), border_variant: rgba(0x000000ff).into(), border_focused: rgba(0x000000ff).into(), - border_disabled: rgba(0x000000ff).into(), border_selected: rgba(0x000000ff).into(), border_transparent: rgba(0x000000ff).into(), + border_disabled: rgba(0x000000ff).into(), elevated_surface_background: rgba(0x1f1d2eff).into(), surface_background: rgba(0x1f1d2eff).into(), background: rgba(0x191724ff).into(), @@ -61,8 +61,17 @@ pub fn rose_pine() -> ThemeFamily { tab_inactive_background: rgba(0x000000ff).into(), tab_active_background: rgba(0x6e6a861a).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x111113ff).into(), terminal_ansi_bright_black: rgba(0x908caaff).into(), terminal_ansi_bright_red: rgba(0xeb6f92ff).into(), @@ -104,24 +113,24 @@ pub fn rose_pine() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -170,7 +179,7 @@ pub fn rose_pine() -> ThemeFamily { }, }, ThemeVariant { - id: "3f6c3263-86f4-4a0e-92a6-144984aa2d38".into(), + id: "fe9e3c9e-954e-4f8e-849e-451ba5f6ceca".into(), name: "Rose Moon".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -184,9 +193,9 @@ pub fn rose_pine() -> ThemeFamily { border: rgba(0x000000ff).into(), border_variant: rgba(0x000000ff).into(), border_focused: rgba(0x000000ff).into(), - border_disabled: rgba(0x000000ff).into(), border_selected: rgba(0x000000ff).into(), border_transparent: rgba(0x000000ff).into(), + border_disabled: rgba(0x000000ff).into(), elevated_surface_background: rgba(0x2a273eff).into(), surface_background: rgba(0x2a273eff).into(), background: rgba(0x232136ff).into(), @@ -219,8 +228,17 @@ pub fn rose_pine() -> ThemeFamily { tab_inactive_background: rgba(0x000000ff).into(), tab_active_background: rgba(0x817c9c14).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x111113ff).into(), terminal_ansi_bright_black: rgba(0x908caaff).into(), terminal_ansi_bright_red: rgba(0xeb6f92ff).into(), @@ -262,24 +280,24 @@ pub fn rose_pine() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -328,7 +346,7 @@ pub fn rose_pine() -> ThemeFamily { }, }, ThemeVariant { - id: "d171cda6-de3b-4528-8559-cd8fb71b2e7c".into(), + id: "00cc7f69-9658-443e-b643-1c8dbffa047d".into(), name: "Rose Pine Dawn".into(), appearance: Appearance::Light, styles: ThemeStyles { @@ -342,9 +360,9 @@ pub fn rose_pine() -> ThemeFamily { border: rgba(0x000000ff).into(), border_variant: rgba(0x000000ff).into(), border_focused: rgba(0x000000ff).into(), - border_disabled: rgba(0x000000ff).into(), border_selected: rgba(0x000000ff).into(), border_transparent: rgba(0x000000ff).into(), + border_disabled: rgba(0x000000ff).into(), elevated_surface_background: rgba(0xfffaf3ff).into(), surface_background: rgba(0xfffaf3ff).into(), background: rgba(0xfaf4edff).into(), @@ -377,8 +395,17 @@ pub fn rose_pine() -> ThemeFamily { tab_inactive_background: rgba(0x000000ff).into(), tab_active_background: rgba(0x6e6a860d).into(), editor_background: rgba(0xfcfcfdff).into(), + editor_gutter_background: rgba(0xfcfcfdff).into(), editor_subheader_background: rgba(0xf9f9fbff).into(), - editor_active_line: rgba(0x0000320f).into(), + editor_active_line_background: rgba(0x0000320f).into(), + editor_highlighted_line_background: rgba(0x00002c17).into(), + editor_line_number: rgba(0x0000320f).into(), + editor_active_line_number: rgba(0x0000320f).into(), + editor_invisible: rgba(0x00002c17).into(), + editor_wrap_guide: rgba(0x00002c17).into(), + editor_active_wrap_guide: rgba(0x00002c17).into(), + editor_document_highlight_read_background: rgba(0x00002c17).into(), + editor_document_highlight_write_background: rgba(0x00002c17).into(), terminal_background: rgba(0xfcfcfdff).into(), terminal_ansi_bright_black: rgba(0x797593ff).into(), terminal_ansi_bright_red: rgba(0xb3627aff).into(), @@ -420,24 +447,24 @@ pub fn rose_pine() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme2/src/themes/solarized.rs b/crates/theme2/src/themes/solarized.rs index d160cfa6524dda6a2deadce08f15032660f2ff0e..cca669479a406c02ceefeedd187e0416e7290fae 100644 --- a/crates/theme2/src/themes/solarized.rs +++ b/crates/theme2/src/themes/solarized.rs @@ -7,12 +7,12 @@ use crate::{ pub fn solarized() -> ThemeFamily { ThemeFamily { - id: "9a6f18c9-520f-46ec-9bfb-a7ee73508139".into(), + id: "96299b3e-c749-478c-bfc9-c96cdaea8630".into(), name: "Solarized".into(), author: "Ethan Schoonover (altercation)".into(), themes: vec![ ThemeVariant { - id: "74003db2-7f9a-4d26-8815-020c796bb551".into(), + id: "265f93c5-c8e7-4962-b083-8550f4b5c2ff".into(), name: "Solarized Dark".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -26,9 +26,9 @@ pub fn solarized() -> ThemeFamily { border: rgba(0x003847ff).into(), border_variant: rgba(0x003847ff).into(), border_focused: rgba(0x003847ff).into(), - border_disabled: rgba(0x003847ff).into(), border_selected: rgba(0x003847ff).into(), border_transparent: rgba(0x003847ff).into(), + border_disabled: rgba(0x003847ff).into(), elevated_surface_background: rgba(0x18191bff).into(), surface_background: rgba(0x18191bff).into(), background: rgba(0x002a35ff).into(), @@ -61,8 +61,17 @@ pub fn solarized() -> ThemeFamily { tab_inactive_background: rgba(0x003f51ff).into(), tab_active_background: rgba(0x002a36ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x111113ff).into(), terminal_ansi_bright_black: rgba(0x586e75ff).into(), terminal_ansi_bright_red: rgba(0xcb4b15ff).into(), @@ -104,24 +113,24 @@ pub fn solarized() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { @@ -170,7 +179,7 @@ pub fn solarized() -> ThemeFamily { }, }, ThemeVariant { - id: "43be149b-2604-4eb2-a9ce-c8f902ab3bb3".into(), + id: "40e2070d-5846-4182-9dc9-bf56badf019f".into(), name: "Solarized Light".into(), appearance: Appearance::Light, styles: ThemeStyles { @@ -184,9 +193,9 @@ pub fn solarized() -> ThemeFamily { border: rgba(0xddd6c1ff).into(), border_variant: rgba(0xddd6c1ff).into(), border_focused: rgba(0xddd6c1ff).into(), - border_disabled: rgba(0xddd6c1ff).into(), border_selected: rgba(0xddd6c1ff).into(), border_transparent: rgba(0xddd6c1ff).into(), + border_disabled: rgba(0xddd6c1ff).into(), elevated_surface_background: rgba(0xf9f9fbff).into(), surface_background: rgba(0xf9f9fbff).into(), background: rgba(0xfdf6e3ff).into(), @@ -219,8 +228,17 @@ pub fn solarized() -> ThemeFamily { tab_inactive_background: rgba(0xd3cbb7ff).into(), tab_active_background: rgba(0xfdf6e3ff).into(), editor_background: rgba(0xfcfcfdff).into(), + editor_gutter_background: rgba(0xfcfcfdff).into(), editor_subheader_background: rgba(0xf9f9fbff).into(), - editor_active_line: rgba(0x0000320f).into(), + editor_active_line_background: rgba(0x0000320f).into(), + editor_highlighted_line_background: rgba(0x00002c17).into(), + editor_line_number: rgba(0x0000320f).into(), + editor_active_line_number: rgba(0x0000320f).into(), + editor_invisible: rgba(0x00002c17).into(), + editor_wrap_guide: rgba(0x00002c17).into(), + editor_active_wrap_guide: rgba(0x00002c17).into(), + editor_document_highlight_read_background: rgba(0x00002c17).into(), + editor_document_highlight_write_background: rgba(0x00002c17).into(), terminal_background: rgba(0xfcfcfdff).into(), terminal_ansi_bright_black: rgba(0x657b83ff).into(), terminal_ansi_bright_red: rgba(0xcb4b15ff).into(), @@ -262,24 +280,24 @@ pub fn solarized() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme2/src/themes/synthwave_84.rs b/crates/theme2/src/themes/synthwave_84.rs index cfe81bef424db8d1352d993c638c0002399767e0..8920037253c510a526c12b278b0f54de5b35fe6f 100644 --- a/crates/theme2/src/themes/synthwave_84.rs +++ b/crates/theme2/src/themes/synthwave_84.rs @@ -7,11 +7,11 @@ use crate::{ pub fn synthwave_84() -> ThemeFamily { ThemeFamily { - id: "5e0f0cd5-5522-45cf-a652-caeb140eb3de".into(), + id: "161a14a0-533c-4df1-b909-2bac37ac807d".into(), name: "Synthwave 84".into(), author: "Robb Owen (robb0wen)".into(), themes: vec![ThemeVariant { - id: "83110d9e-dbf0-4f36-9a4c-6b396ce9a5a4".into(), + id: "7a7102b7-8778-4c24-ba79-7407857b4f8c".into(), name: "Synthwave 84".into(), appearance: Appearance::Dark, styles: ThemeStyles { @@ -25,9 +25,9 @@ pub fn synthwave_84() -> ThemeFamily { border: rgba(0x363a3fff).into(), border_variant: rgba(0x2e3135ff).into(), border_focused: rgba(0x004073ff).into(), - border_disabled: rgba(0x212225ff).into(), border_selected: rgba(0x004073ff).into(), border_transparent: rgba(0x00000000).into(), + border_disabled: rgba(0x212225ff).into(), elevated_surface_background: rgba(0x18191bff).into(), surface_background: rgba(0x18191bff).into(), background: rgba(0x252334ff).into(), @@ -60,8 +60,17 @@ pub fn synthwave_84() -> ThemeFamily { tab_inactive_background: rgba(0x252334ff).into(), tab_active_background: rgba(0x111113ff).into(), editor_background: rgba(0x111113ff).into(), + editor_gutter_background: rgba(0x111113ff).into(), editor_subheader_background: rgba(0x18191bff).into(), - editor_active_line: rgba(0xddeaf814).into(), + editor_active_line_background: rgba(0xddeaf814).into(), + editor_highlighted_line_background: rgba(0xd3edf81d).into(), + editor_line_number: rgba(0xddeaf814).into(), + editor_active_line_number: rgba(0xddeaf814).into(), + editor_invisible: rgba(0xd3edf81d).into(), + editor_wrap_guide: rgba(0xd3edf81d).into(), + editor_active_wrap_guide: rgba(0xd3edf81d).into(), + editor_document_highlight_read_background: rgba(0xd3edf81d).into(), + editor_document_highlight_write_background: rgba(0xd3edf81d).into(), terminal_background: rgba(0x111113ff).into(), terminal_ansi_bright_black: rgba(0x000000e6).into(), terminal_ansi_bright_red: rgba(0xfe444fff).into(), @@ -103,24 +112,24 @@ pub fn synthwave_84() -> ThemeFamily { }, player: PlayerColors(vec![ PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, PlayerColor { - cursor: rgba(0x00000000).into(), - background: rgba(0x00000000).into(), - selection: rgba(0x00000000).into(), + cursor: rgba(0x000000ff).into(), + background: rgba(0x000000ff).into(), + selection: rgba(0x000000ff).into(), }, ]), syntax: SyntaxTheme { diff --git a/crates/theme_importer/src/theme_printer.rs b/crates/theme_importer/src/theme_printer.rs index 98765d612942db461f94c7290a86c39bae589cee..f638694be8dea07a76ee797a672244d62fd427f0 100644 --- a/crates/theme_importer/src/theme_printer.rs +++ b/crates/theme_importer/src/theme_printer.rs @@ -134,12 +134,12 @@ impl<'a> Debug for ThemeColorsPrinter<'a> { .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("border_disabled", &HslaPrinter(self.0.border_disabled)) .field( "elevated_surface_background", &HslaPrinter(self.0.elevated_surface_background), @@ -220,13 +220,43 @@ impl<'a> Debug for ThemeColorsPrinter<'a> { &HslaPrinter(self.0.tab_active_background), ) .field("editor_background", &HslaPrinter(self.0.editor_background)) + .field( + "editor_gutter_background", + &HslaPrinter(self.0.editor_gutter_background), + ) .field( "editor_subheader_background", &HslaPrinter(self.0.editor_subheader_background), ) .field( - "editor_active_line", - &HslaPrinter(self.0.editor_active_line), + "editor_active_line_background", + &HslaPrinter(self.0.editor_active_line_background), + ) + .field( + "editor_highlighted_line_background", + &HslaPrinter(self.0.editor_highlighted_line_background), + ) + .field( + "editor_line_number", + &HslaPrinter(self.0.editor_line_number), + ) + .field( + "editor_active_line_number", + &HslaPrinter(self.0.editor_active_line_number), + ) + .field("editor_invisible", &HslaPrinter(self.0.editor_invisible)) + .field("editor_wrap_guide", &HslaPrinter(self.0.editor_wrap_guide)) + .field( + "editor_active_wrap_guide", + &HslaPrinter(self.0.editor_active_wrap_guide), + ) + .field( + "editor_document_highlight_read_background", + &HslaPrinter(self.0.editor_document_highlight_read_background), + ) + .field( + "editor_document_highlight_write_background", + &HslaPrinter(self.0.editor_document_highlight_write_background), ) .field( "terminal_background", diff --git a/crates/ui2/src/to_extract/buffer.rs b/crates/ui2/src/to_extract/buffer.rs index 8ab435e9947bb4746613a4f1fd1ba2f5576a2a9f..aa4bebc9d5d5cdaa23f1429af7d64b71751c99c0 100644 --- a/crates/ui2/src/to_extract/buffer.rs +++ b/crates/ui2/src/to_extract/buffer.rs @@ -156,7 +156,7 @@ impl Buffer { fn render_row(row: BufferRow, cx: &WindowContext) -> impl Component { 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 }; diff --git a/crates/zed2/src/main.rs b/crates/zed2/src/main.rs index 52eb512eb4e4c47850031689f13f336f89488b6b..580afd265370c1052554b85affb600b98046e913 100644 --- a/crates/zed2/src/main.rs +++ b/crates/zed2/src/main.rs @@ -38,6 +38,7 @@ use std::{ thread, time::{SystemTime, UNIX_EPOCH}, }; +use theme::ActiveTheme; use util::{ async_maybe, channel::{parse_zed_link, ReleaseChannel, RELEASE_CHANNEL}, @@ -164,7 +165,7 @@ fn main() { // .detach(); // watch_file_types(fs.clone(), cx); - // languages.set_theme(theme::current(cx).clone()); + languages.set_theme(cx.theme().clone()); // cx.observe_global::({ // let languages = languages.clone(); // move |cx| languages.set_theme(theme::current(cx).clone())